-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHome.js
41 lines (35 loc) · 1001 Bytes
/
Home.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
'use strict';
import React, {Component} from 'react';
import {
View,
ListView,
Text,
TouchableHighlight
} from 'react-native';
var superheroArray = ["Superman","Batman","Wonder Woman","The Flash","Aquaman","Green Lantern"];
class Home extends Component {
constructor(props) {
super(props);
var dataSource = new ListView.DataSource({rowHasChanged:(r1,r2) => r1.guid != r2.guid});
this.state = {
dataSource: dataSource.cloneWithRows(superheroArray)
}
}
renderRow(rowData, sectionID, rowID) {
return (
<TouchableHighlight underlayColor='#dddddd' style={{height:44}}>
<View>
<Text style={{fontSize: 20, color: '#000000'}} numberOfLines={1}>{rowData}</Text>
<View style={{height: 1, backgroundColor: '#dddddd'}}/>
</View>
</TouchableHighlight>
);
}
render() {
return(
<ListView dataSource={this.state.dataSource} renderRow={this.renderRow.bind(this)}>
</ListView>
);
}
}
module.exports = Home;