-
Notifications
You must be signed in to change notification settings - Fork 427
/
Copy pathTagGroup.js
72 lines (63 loc) · 2.22 KB
/
TagGroup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import React, {
Component,
} from 'react';
import {
Text,
View,
TouchableOpacity,
} from 'react-native';
import PropTypes from 'prop-types';
import styles from "../../style/index"
import * as Constant from "../../style/constant"
import {Actions} from "react-native-router-flux";
/**
* 标签控件
*/
class TagGroup extends Component {
constructor(props) {
super(props);
}
render() {
if (!this.props.tagList || this.props.tagList.length === 0) {
return <View/>
}
return (
<View style={[styles.flexDirectionRow, {flexWrap: "wrap"}, this.props.groupStyle]}>
{
this.props.tagList.map((data) => {
return (
<TouchableOpacity
onPress={() => {
Actions.ListPage({
dataType: 'topics', showType: 'repository',
title: data,
topic: data
})
}}
key={"_" + data}
style={[styles.centered, {
borderRadius: 4,
height: 24,
overflow: 'hidden',
paddingHorizontal: Constant.normalMarginEdge,
backgroundColor: Constant.white,
marginVertical: Constant.normalMarginEdge / 2,
marginRight: Constant.normalMarginEdge,
}]}>
<Text numberOfLines={1}
style={[styles.centered, styles.smallText]}>
{data}
</Text>
</TouchableOpacity>
)
})
}
</View>
);
}
}
TagGroup.propTypes = {
groupStyle: PropTypes.any,
tagList: PropTypes.array,
};
export default TagGroup;