-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
57 lines (50 loc) · 1.28 KB
/
App.tsx
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
import { StyleSheet, View } from "react-native";
import { useState } from "react";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { Select } from "./src/components/Select";
const FRUITS = [
{ id: 1, name: "Apple 🍎" },
{ id: 2, name: "Banana 🍌" },
{ id: 3, name: "Orange 🍊" },
{ id: 4, name: "Grape 🍇" },
{ id: 5, name: "Strawberry 🍓" },
{ id: 6, name: "Pear 🍐" },
{ id: 7, name: "Pineapple 🍍" },
{ id: 8, name: "Watermelon 🍉" },
{ id: 9, name: "Kiwi 🥝" },
{ id: 10, name: "Cherry 🍒" },
];
type Fruit = (typeof FRUITS)[number];
function App() {
const [fruit, setFruit] = useState<Fruit | null>(null);
return (
<GestureHandlerRootView style={styles.container}>
<View style={styles.content}>
<Select
placeholder="Selecione uma fruta"
items={FRUITS}
onSelectValue={(item) => setFruit(item)}
getOptionLabel={(item) => item.name}
value={fruit?.name}
modalProps={{
snapPoints: ["40%"],
enableDynamicSizing: false,
}}
/>
</View>
</GestureHandlerRootView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "white",
},
content: {
flex: 1,
justifyContent: "center",
alignItems: "center",
padding: 20,
},
});
export default App;