-
Notifications
You must be signed in to change notification settings - Fork 427
/
Copy pathUserItem.js
85 lines (77 loc) · 2.74 KB
/
UserItem.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
73
74
75
76
77
78
79
80
81
82
83
84
85
import React, {
Component,
} from 'react'
import {
View, Text, Image, TouchableOpacity
} from 'react-native';
import PropTypes from 'prop-types';
import styles from '../../style'
import * as Constant from '../../style/constant'
import {Actions} from 'react-native-router-flux';
import UserImage from './UserImage'
/**
* 用户列表Item
*/
class UserItem extends Component {
constructor(props) {
super(props)
}
componentDidMount() {
}
componentWillUnmount() {
}
render() {
let {location, actionUser, actionUserPic} = this.props;
let bottomDes = (this.props.des) ?
<Text style={[styles.subSmallText,
{marginTop: Constant.normalMarginEdge,}]}
numberOfLines={Constant.normalNumberOfLine}>
{this.props.des}
</Text> : <View/>;
return (
<TouchableOpacity
style={[{
marginVertical: Constant.normalMarginEdge / 2,
marginLeft: Constant.normalMarginEdge,
marginRight: Constant.normalMarginEdge,
padding: Constant.normalMarginEdge,
borderRadius: 4,
}, styles.shadowCard]}
onPress={() => {
Actions.PersonPage({currentUser: actionUser})
}}>
<View style={[styles.flexDirectionRowNotFlex,]}>
<UserImage uri={actionUserPic}
loginUser={actionUser}
resizeMethod="scale"
style={[{
height: Constant.smallIconSize, width: Constant.smallIconSize,
marginTop: 5,
borderRadius: Constant.smallIconSize / 2
}]}/>
<View style={[styles.flex, styles.centerH, styles.flexDirectionRowNotFlex]}>
<Text style={[styles.flex, styles.smallText, {
fontWeight: "bold",
marginLeft: Constant.normalMarginEdge / 2
}]}>
{actionUser}
</Text>
<Text style={[styles.subSmallText,
{marginTop: -20}]}>
{location}
</Text>
</View>
</View>
{bottomDes}
</TouchableOpacity>
)
}
}
const propTypes = {
location: PropTypes.string,
actionUser: PropTypes.string,
actionUserPic: PropTypes.string,
des: PropTypes.string,
};
UserItem.propTypes = propTypes;
export default UserItem