-
Notifications
You must be signed in to change notification settings - Fork 12
/
App.js
116 lines (111 loc) · 3.74 KB
/
App.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import React from 'react';
import { StyleSheet, Text, View, FlatList, Image, TouchableOpacity } from 'react-native';
function Item({ item }) {
return (
<View style={styles.listItem}>
<Image source={{uri:item.photo}} style={{width:60, height:60,borderRadius:30}} />
<View style={{alignItems:"center",flex:1}}>
<Text style={{fontWeight:"bold"}}>{item.name}</Text>
<Text>{item.position}</Text>
</View>
<TouchableOpacity style={{height:50,width:50, justifyContent:"center",alignItems:"center"}}>
<Text style={{color:"green"}}>Call</Text>
</TouchableOpacity>
</View>
);
}
export default class App extends React.Component {
state = {
data:[
{
"name": "Miyah Myles",
"email": "[email protected]",
"position": "Data Entry Clerk",
"photo": "https:\/\/images.unsplash.com\/photo-1494790108377-be9c29b29330?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=200&fit=max&s=707b9c33066bf8808c934c8ab394dff6"
},
{
"name": "June Cha",
"email": "[email protected]",
"position": "Sales Manager",
"photo": "https:\/\/randomuser.me\/api\/portraits\/women\/44.jpg"
},
{
"name": "Iida Niskanen",
"email": "[email protected]",
"position": "Sales Manager",
"photo": "https:\/\/randomuser.me\/api\/portraits\/women\/68.jpg"
},
{
"name": "Renee Sims",
"email": "[email protected]",
"position": "Medical Assistant",
"photo": "https:\/\/randomuser.me\/api\/portraits\/women\/65.jpg"
},
{
"name": "Jonathan Nu\u00f1ez",
"email": "jonathan.nu\[email protected]",
"position": "Clerical",
"photo": "https:\/\/randomuser.me\/api\/portraits\/men\/43.jpg"
},
{
"name": "Sasha Ho",
"email": "[email protected]",
"position": "Administrative Assistant",
"photo": "https:\/\/images.pexels.com\/photos\/415829\/pexels-photo-415829.jpeg?h=350&auto=compress&cs=tinysrgb"
},
{
"name": "Abdullah Hadley",
"email": "[email protected]",
"position": "Marketing",
"photo": "https:\/\/images.unsplash.com\/photo-1507003211169-0a1dd7228f2d?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=200&fit=max&s=a72ca28288878f8404a795f39642a46f"
},
{
"name": "Thomas Stock",
"email": "[email protected]",
"position": "Product Designer",
"photo": "https:\/\/tinyfac.es\/data\/avatars\/B0298C36-9751-48EF-BE15-80FB9CD11143-500w.jpeg"
},
{
"name": "Veeti Seppanen",
"email": "[email protected]",
"position": "Product Designer",
"photo": "https:\/\/randomuser.me\/api\/portraits\/men\/97.jpg"
},
{
"name": "Bonnie Riley",
"email": "[email protected]",
"position": "Marketing",
"photo": "https:\/\/randomuser.me\/api\/portraits\/women\/26.jpg"
}
]
}
render(){
return (
<View style={styles.container}>
<FlatList
style={{flex:1}}
data={this.state.data}
renderItem={({ item }) => <Item item={item}/>}
keyExtractor={item => item.email}
/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#F7F7F7',
marginTop:60
},
listItem:{
margin:10,
padding:10,
backgroundColor:"#FFF",
width:"80%",
flex:1,
alignSelf:"center",
flexDirection:"row",
borderRadius:5
}
});