Skip to content

Instantly share code, notes, and snippets.

@syamjayaraj
Created July 24, 2018 19:47
Show Gist options
  • Save syamjayaraj/e9110d784ca3cdef7e4a6685c14a90b9 to your computer and use it in GitHub Desktop.
Save syamjayaraj/e9110d784ca3cdef7e4a6685c14a90b9 to your computer and use it in GitHub Desktop.
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