-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitemMaterials.js
85 lines (77 loc) · 1.57 KB
/
itemMaterials.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
/**
* Created by zhanjiyuan on 15/11/7.
*/
'use strict';
var React = require('react-native');
var {
PixelRatio,
AppRegistry,
NavigatorIOS,
Image,
Platform,
StyleSheet,
Text,
TouchableHighlight,
TouchableNativeFeedback,
View,
} = React;
var ratio = PixelRatio.get();
var ItemMaterials = React.createClass({
render: function() {
var TouchableElement = TouchableHighlight;
if (Platform.OS === 'android') {
TouchableElement = TouchableNativeFeedback;
}
return (
<View>
<TouchableElement
onPress={this.props.onSelect}
>
<View style={styles.container}>
<Image
source={{uri: this.props.data.avatar_url}}
style={styles.thumbnail}
/>
<View style={styles.right}>
<Text style={styles.name} numberOfLines = {1}>{this.props.data.name}</Text>
<Text style={styles.description} numberOfLines = {1}>{this.props.data.description}</Text>
</View>
</View>
</TouchableElement>
</View>
);
}
});
var styles = StyleSheet.create({
container: {
flexDirection: 'row',
alignItems: 'center',
padding: 10,
backgroundColor: 'white',
},
thumbnail: {
width: 50,
height: 50,
borderRadius: 25,
marginLeft: 10,
marginRight: 10,
},
name: {
flex: 1,
fontSize: 16,
fontWeight: 'bold',
paddingBottom: 3,
paddingRight: 2,
},
description: {
flex: 1,
fontSize: 12,
color: '#666666',
paddingTop: 3,
paddingRight: 2,
},
right: {
flex: 1,
}
});
module.exports = ItemMaterials;