-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
149 lines (127 loc) · 3.04 KB
/
App.js
File metadata and controls
149 lines (127 loc) · 3.04 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import React, { useState } from 'react';
import { StyleSheet, Text, View, SafeAreaView, Dimensions, TextInput, Button, TouchableOpacity, FlatList, StatusBar } from 'react-native';
function DataList({ title }) {
return (
<View style={styles.dataview}>
<Text style={styles.title}>{title}</Text>
</View>
);
}
export default function App() {
const [name, setName] = useState('');
const data = [
{
id: 'bd7acbea-c1b1-46c2-aed5-3ad53abb28ba',
title: 'Kelviny Henrique',
},
{
id: '3ac68afc-c605-48d3-a4f8-fbd91aa97f63',
title: 'Caio Carnelos',
},
{
id: '58694a0f-3da1-471f-bd96-145571e29d72',
title: 'Kaio Prates',
},
];
const handleSort = () => {
alert("Aqui");
}
const handleReset = () => {
alert("Aqui2");
}
return (
<SafeAreaView style={styles.container}>
<StatusBar barStyle="light-content" />
<View style={styles.navbar}>
<Text style={styles.text}>InstaSort</Text>
</View>
<View style={{
width: width,
alignItems: 'center',
justifyContent: 'center'
}}>
<TextInput style={styles.inputText} />
<View style={styles.viewbutton}>
<TouchableOpacity style={styles.button} onPress={handleSort}>
<Text style={styles.textbutton}>Sort</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.buttonRed} onPress={handleReset} >
<Text style={styles.textbutton}>Reset</Text>
</TouchableOpacity>
</View>
<FlatList
data={data}
renderItem={({ item }) => <DataList title={item.title} />}
keyExtractor={item => item.id}
/>
</View>
</SafeAreaView>
);
}
var width = Dimensions.get('window').width; //full width
var height = Dimensions.get('window').height; //full height
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
},
navbar: {
width: width,
backgroundColor: '#FC4A1A',
height: 50,
paddingBottom: 5,
alignSelf: 'stretch',
justifyContent: 'center',
},
text: {
marginLeft: 20,
color: '#fff',
fontSize: 20,
},
dataview: {
width: width - 50,
borderWidth: 1,
borderColor: '#CCC',
height: 40,
borderRadius: 4,
alignItems: 'center',
justifyContent: 'center',
marginBottom: 20,
},
inputText: {
marginTop: 50,
width: 350,
height: 50,
borderWidth: 1,
borderColor: '#CCC',
borderRadius: 35,
},
textbutton: {
color: '#FFF',
fontSize: 20,
},
viewbutton: {
width: width,
height: 100,
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-around'
},
button: {
width: 150,
height: 40,
borderRadius: 20,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#02D917',
},
buttonRed: {
width: 150,
height: 40,
borderRadius: 20,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#FF5E5E',
}
});