-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRegionView.js
82 lines (74 loc) · 1.74 KB
/
RegionView.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
'use strict';
var React = require('react-native');
var {
StyleSheet,
Image,
View,
TouchableHighlight,
ListView,
Text,
Component
} = React;
class RegionView extends Component {
constructor(props) {
super(props);
var dataSource = new ListView.DataSource(
{rowHasChanged: (r1, r2) => r1.guid !== r2.guid}
);
this.state = {
dataSource: dataSource.cloneWithRows(this.props.currency)
};
}
rowPressed(key) {
var currency = this.props.currency
.filter(prop => prop.key === key)[0];
this.props.onSelect(key);
this.props.navigator.pop();
}
renderRow(rowData, sectionID, rowID) {
console.log(rowData);
return (
<TouchableHighlight onPress={() => this.rowPressed(rowData.key)}
underlayColor='#dddddd'>
<View>
<View style={styles.rowContainer}>
<View style={styles.textContainer}>
<Text style={styles.title}>
{rowData.name}
</Text>
</View>
</View>
<View style={styles.separator}/>
</View>
</TouchableHighlight>
);
}
render() {
return (
<ListView
dataSource={this.state.dataSource}
renderRow={this.renderRow.bind(this)}/>
);
}
}
var styles = StyleSheet.create({
container: {
flex: 1,
paddingLeft: 20,
paddingRight: 20,
paddingTop: 10,
paddingBottom: 10,
flexDirection: 'row',
justifyContent: 'flex-start',
alignItems: 'center', //flex-start, flex-end, center, stretch
},
separator: {
height: 1,
backgroundColor: '#dddddd'
},
rowContainer: {
flexDirection: 'row',
padding: 10
}
});
module.exports = RegionView;