Created
July 24, 2018 19:47
-
-
Save syamjayaraj/e9110d784ca3cdef7e4a6685c14a90b9 to your computer and use it in GitHub Desktop.
This file contains 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
export default class FAB extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
data: [ | |
{ name: 'John', age: 18 }, | |
{ name: 'Lilli', age: 23 }, | |
{ name: 'Lavera', age: 46 }, | |
{ name: 'Paul', age: 32 }, | |
{ name: 'Jene', age: 14 }, | |
{ name: 'Felipe', age: 42 }, | |
{ name: 'Shawn', age: 26 }, | |
{ name: 'Carey', age: 24 }, | |
{ name: 'Mark', age: 33 } | |
] | |
} | |
} | |
| |
render() { | |
const { data } = this.state; | |
return ( | |
<View style={styles.container}> | |
... | |
... | |
<FlatList | |
data={data} | |
renderItem={({ item }) => <View style={styles.list}> | |
<Text>Name : {item.name}</Text> | |
<Text>Age : {item.age}</Text> | |
</View>} | |
/> | |
</View> | |
) | |
} | |
} | |
const styles = StyleSheet.create({ | |
... | |
... | |
list: { | |
margin: 5, | |
backgroundColor: 'white', | |
height: 80, | |
justifyContent: 'space-around', | |
paddingLeft: 10, | |
elevation: 1 | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment