-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgridCell.js
75 lines (64 loc) · 1.39 KB
/
gridCell.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
/*
* props from parent: cell, onPress;
* cell is a json data contains: picName, name;
*/
'use strict';
var React = require('react-native');
var {
Image,
Text,
StyleSheet,
View,
TouchableHighlight,
TouchableNativeFeedback,
Platform,
} = React;
var gridCell = React.createClass({
render: function() {
var picName = this.props.cell.picName;
var name = this.props.cell.name;
var TouchableElement = TouchableHighlight;
if (Platform.OS === 'android') {
TouchableElement = TouchableNativeFeedback;
};
return (
<View>
<TouchableElement
onPress={this.props.onPress}>
<View style={styles.container}>
<Image style={styles.cellImage} source={{uri:picName}} />
<Text style={styles.name}>
{name}
</Text>
</View>
</TouchableElement>
</View>
);
},
});
var styles = StyleSheet.create({
container: {
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#F5FCFF',
},
name: {
fontSize: 20,
textAlign: 'center',
// margin: 10,
color: '#333333',
},
cellImage: {
borderRadius: 10,
backgroundColor: '#333333',
height: 80,
marginLeft: 10,
marginRight: 10,
marginTop: 10,
marginBottom: 2,
width: 64,
resizeMode: 'stretch',
},
});
module.exports = gridCell;