Skip to content

Instantly share code, notes, and snippets.

@syamjayaraj syamjayaraj/App.js
Created Jul 24, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.