Last active
June 27, 2017 13:27
-
-
Save Louiefigz/548f0032bc871446d0f20181efbba939 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import { ScrollView, Text, StyleSheet, View, TextInput, ListView } from 'react-native'; | |
| export default class App extends React.Component { | |
| constructor(){ | |
| super(); | |
| const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); | |
| this.state={ | |
| text:'', | |
| restaurants:[], | |
| dataSource: ds.cloneWithRows([ | |
| 'John', 'Joel', 'James', 'Jimmy', 'Jackson', 'Jillian', 'Julie', 'Devin' | |
| ]) | |
| } | |
| } | |
| render() { | |
| return ( | |
| <View> | |
| <TextInput | |
| style={styles.input} | |
| placeholder="Feed Me" | |
| onChangeText={(text) => this.setState({text})} | |
| /> | |
| <View style={styles.background}> | |
| <ListView | |
| dataSource={this.state.dataSource} | |
| renderRow={(rowData) => <Text style={styles.font}>{rowData}</Text>} | |
| /> | |
| </View> | |
| </View> | |
| ); | |
| } | |
| } | |
| const styles = StyleSheet.create({ | |
| background:{ | |
| alignItems: 'center' | |
| }, | |
| font:{ | |
| fontSize: 30, | |
| }, | |
| input:{ | |
| height: 40, marginTop:30, borderColor: 'gray', borderWidth: 1, textAlign: 'center' | |
| } | |
| }) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment