-
Notifications
You must be signed in to change notification settings - Fork 427
/
Copy pathCommonNameValueItem.js
42 lines (37 loc) · 1.21 KB
/
CommonNameValueItem.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
import React, {Component} from 'react';
import {
View, Text, TouchableOpacity
} from 'react-native';
import styles from "../../style/index"
import PropTypes from 'prop-types';
import * as Constant from '../../style/constant'
/**
* 垂直两行文本按键item
*/
class CommonNameValueItem extends Component {
constructor(props) {
super(props)
}
render() {
let halfEdge = Constant.normalMarginEdge / 2;
let bottomTopTextStyle = [styles.subSmallText, {
marginTop: halfEdge
},];
let bottomBottomTextStyle = [styles.subLightSmallText, {marginVertical: halfEdge}];
return (
<TouchableOpacity style={[...this.props.itemStyle]} onPress={() => {
this.props.onItemPress && this.props.onItemPress();
}}>
<Text style={[...bottomTopTextStyle]}>{this.props.itemName}</Text>
<Text style={[...bottomBottomTextStyle]}>{this.props.itemValue}</Text>
</TouchableOpacity>
)
}
}
CommonNameValueItem.propTypes = {
itemStyle: PropTypes.any,
itemName: PropTypes.string,
itemValue: PropTypes.string,
onItemPress: PropTypes.func,
};
export default CommonNameValueItem;