-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathListCell.js
115 lines (107 loc) · 2.36 KB
/
ListCell.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
'use strict';
var React = require('react-native');
var {
StyleSheet,
Text,
View,
Image,
TouchableHighlight
} = React;
var ListCell = React.createClass({
render () {
var item = this.props.item;
return (
<TouchableHighlight underlayColor="#f1f1f1" onPress={ this.props.gotoDetail }>
<View style={[styles.container, styles.item]}>
<Image
source={{uri: `http:${ item.member.avatar_large }`}}
style={styles.thumbnail}
/>
<View style={styles.itemDetail}>
<Text style={styles.title}>{ item.title }</Text>
<View style={styles.info}>
{ this.props.showNode ? (
<View style={styles.nodeWrapper}>
<Text style={styles.node}>{ item.node.title }</Text>
</View>
) : null }
{ this.props.showNode ? (
<Text style={styles.infoDot}>·</Text>
) : null }
<Text style={styles.username}>{ item.member.username }</Text>
</View>
</View>
<View style={styles.repliesWrapper}>
<Text style={styles.replies}>{ item.replies }</Text>
</View>
</View>
</TouchableHighlight>
);
}
});
var styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
},
item: {
height: 80,
paddingLeft: 10,
paddingRight: 10
},
thumbnail: {
width: 60,
height: 60
},
itemDetail: {
flex: 1,
height: 60,
marginLeft: 10
},
title: {
lineHeight: 16,
height: 32,
overflow: 'hidden',
color: '#778087'
},
info: {
marginTop: 12,
flex: 1,
flexDirection: 'row',
},
nodeWrapper: {
backgroundColor: 'rgb(226, 226, 226)',
borderRadius: 2,
paddingLeft: 2,
paddingRight: 2,
},
node: {
fontSize: 12,
color: 'rgb(153, 153, 153)',
fontFamily: 'arial'
},
infoDot: {
marginLeft: 6,
marginRight: 6,
color: 'rgb(204, 204, 204)'
},
username: {
fontSize: 12,
color: 'rgb(119, 128, 135)',
fontWeight: '700'
},
repliesWrapper: {
width: 26,
marginLeft: 10,
},
replies: {
textAlign: 'center',
backgroundColor: 'rgb(170, 176, 198)',
color: '#fff',
fontWeight: '700',
fontSize: 12
}
});
module.exports = ListCell;