-
Notifications
You must be signed in to change notification settings - Fork 3
/
App.tsx
38 lines (34 loc) · 962 Bytes
/
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
import React, { FC, useState } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import Dropdown from './src/components/Dropdown';
const App: FC = () => {
const [selected, setSelected] = useState(undefined);
const data = [
{ label: 'One', value: '1' },
{ label: 'Two', value: '2' },
{ label: 'Three', value: '3' },
{ label: 'Four', value: '4' },
{ label: 'Five', value: '5' },
];
return (
<View style={styles.container}>
{!!selected && (
<Text>
Selected: label = {selected.label} and value = {selected.value}
</Text>
)}
<Dropdown label="Select Item" data={data} onSelect={setSelected} />
<Text>This is the rest of the form.</Text>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
flexDirection: 'column',
},
});
export default App;