-
Notifications
You must be signed in to change notification settings - Fork 1
/
FlatListHome.js
63 lines (52 loc) · 1.63 KB
/
FlatListHome.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import React, {Component} from 'react';
import {View, FlatList, Image, StyleSheet, ScrollView, Text} from 'react-native';
class App extends Component {
constructor(props){
super(props);
this.state ={
feed:[
{id:'1', nome: 'Isa', idade:20, email:'[email protected]'},
{id:'2', nome: 'Belinha', idade:40, email:'[email protected]'},
{id:'3', nome: 'Jessica', idade:23, email:'[email protected]'},
{id:'4', nome: 'Camila', idade:32, email:'[email protected]'},
{id:'5', nome: 'Batolomeu', idade:52, email:'[email protected]'},
]
};
}
render(){
return (
<View style={styles.container}>
<FlatList
data={this.state.feed}
renderItem={ ({item}) => <Pessoa data={item}/>}
keyExtractor={(item) => item.id }
/>
</View>
);
}}
class Pessoa extends Component{
render(){
return(
<View style={styles.areaPessoa}>
<Text style={styles.textoPessoa}>{this.props.data.nome}</Text>
<Text style={styles.textoPessoa}>{this.props.data.idade}</Text>
<Text style={styles.textoPessoa}>{this.props.data.email}</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container:{
flex:1,
},
areaPessoa:{
backgroundColor:'#222',
height: 200,
marginBottom: 15
},
textoPessoa:{
color:'#FFF',
fontSize:20
}
});
export default App;