-
Notifications
You must be signed in to change notification settings - Fork 427
/
Copy pathIconTextItem.js
56 lines (47 loc) · 1.44 KB
/
IconTextItem.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
import React, {Component} from 'react';
import {
View, Text
} from 'react-native';
import PropTypes from 'prop-types';
import styles from "../../style"
import * as Constant from '../../style/constant'
import Icon from 'react-native-vector-icons/FontAwesome'
class IconTextItem extends Component {
componentDidMount() {
}
componentWillUnmount() {
}
render() {
let smallIconTextStyle = [styles.flexDirectionRowNotFlex, styles.centerH];
let halfEdge = (this.props.icon) ? Constant.normalMarginEdge / 2 : 0;
let iconView = (this.props.icon) ?
<Icon name={this.props.icon} size={this.props.iconSize} color={this.props.iconColor}/>
: <View/>;
return (
<View
style={[...smallIconTextStyle, ...this.props.viewstyle]}>
{iconView}
<Text style={[{marginLeft: halfEdge},
...this.props.textstyle,]}
selectable={true}>
{this.props.text}
</Text>
</View>
)
}
}
IconTextItem.propTypes = {
text: PropTypes.string,
icon: PropTypes.string,
iconColor: PropTypes.string,
iconSize: PropTypes.number,
textstyle: PropTypes.any,
viewstyle: PropTypes.any,
};
IconTextItem.defaultProps = {
textstyle: [],
viewstyle: [],
iconColor: Constant.miWhite,
iconSize: Constant.littleIconSize,
};
export default IconTextItem;