forked from mrzachnugent/react-native-reusables
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcombobox.tsx
42 lines (40 loc) · 824 Bytes
/
combobox.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
import React from 'react';
import { View } from 'react-native';
import { Combobox, ComboboxOption } from '~/components/ui/combobox';
const frameworks = [
{
value: 'next.js',
label: 'Next.js',
},
{
value: 'sveltekit',
label: 'SvelteKit',
},
{
value: 'nuxt.js',
label: 'Nuxt.js',
},
{
value: 'remix',
label: 'Remix',
},
{
value: 'astro',
label: 'Astro',
},
];
export default function ComboboxScreen() {
const [selectedItem, setSelectedItem] = React.useState<ComboboxOption | null>(
null
);
return (
<View className='flex-1 justify-center items-center p-6'>
<Combobox
selectedItem={selectedItem}
onSelectedItemChange={setSelectedItem}
placeholder='Select framework'
items={frameworks}
/>
</View>
);
}