|
1 | 1 | import React, { JSX } from 'react'; |
2 | | -import { FlatList, StyleSheet, useColorScheme,View } from 'react-native'; |
| 2 | +import { FlatList, StyleSheet, useColorScheme, View } from 'react-native'; |
3 | 3 | import { GestureHandlerRootView } from 'react-native-gesture-handler'; |
4 | 4 |
|
5 | 5 | // todo: resolve import with eslint compliance |
6 | 6 | // eslint-disable-next-line import/no-unresolved |
7 | | -import DropDownPickerExample, { ExampleProps } from './example-src-files/example'; |
| 7 | +import DropDownPickerExample, { |
| 8 | + ExampleProps, |
| 9 | +} from './example-src-files/example'; |
8 | 10 |
|
9 | | -const EXAMPLES: Array<ExampleProps> = [{ |
10 | | - title: "Default Example", |
11 | | - description: "This is the default dropdown picker" |
12 | | -},{ |
13 | | - title: "Multiple Select", |
14 | | - description: "Multiple select example", |
15 | | - multiple: true |
16 | | -},{ |
17 | | - title: "Multiple Select Badge Mode", |
18 | | - description: "Multiple select example - with badges", |
19 | | - multiple: true, |
20 | | - dropdownProps: {mode: "BADGE", showBadgeDot: false}, |
21 | | -},{ |
22 | | - title: "Multiple Select Badge Mode with Dots", |
23 | | - description: "Multiple select example - with badges and dots", |
24 | | - multiple: true, |
25 | | - dropdownProps: {mode: "BADGE", showBadgeDot: true}, |
26 | | -},{ |
27 | | - title: "Customized Multiple Select Badge Mode", |
28 | | - description: "Multiple select example - with badges", |
29 | | - multiple: true, |
30 | | - dropdownProps: { |
31 | | - mode: "BADGE", |
32 | | - showBadgeDot: false, |
33 | | - badgeDotStyle: {}, |
34 | | - badgeColors: '#d5c4a1', // Badge Colors currentlly overwites badgeStyle background color |
35 | | - placeholderStyle: {color: '#83a598'}, |
36 | | - badgeStyle: { |
37 | | - // background: '#d5c4a1', |
38 | | - borderColor: '#282828', |
39 | | - borderWidth: 2, |
40 | | - borderStyle: 'solid', |
41 | | - }, |
42 | | - badgeTextStyle: { |
43 | | - color: '#282828' |
44 | | - }, |
45 | | - style: { |
46 | | - backgroundColor: '#fbf1c7', |
47 | | - borderColor: '#b16286', |
48 | | - cursor: 'pointer' |
49 | | - }, |
50 | | - customItemContainerStyle: { |
51 | | - }, |
52 | | - listItemContainerStyle: { |
53 | | - backgroundColor: '#fbf1c7', |
54 | | - borderColor: '#b16286' |
| 11 | +const EXAMPLES: Array<ExampleProps> = [ |
| 12 | + { |
| 13 | + title: 'Default Example', |
| 14 | + description: 'This is the default dropdown picker', |
| 15 | + }, |
| 16 | + { |
| 17 | + title: 'Multiple Select', |
| 18 | + description: 'Multiple select example', |
| 19 | + multiple: true, |
| 20 | + }, |
| 21 | + { |
| 22 | + title: 'Multiple Select Badge Mode', |
| 23 | + description: 'Multiple select example - with badges', |
| 24 | + multiple: true, |
| 25 | + dropdownProps: { mode: 'BADGE', showBadgeDot: false }, |
| 26 | + }, |
| 27 | + { |
| 28 | + title: 'Multiple Select Badge Mode with Dots', |
| 29 | + description: 'Multiple select example - with badges and dots', |
| 30 | + multiple: true, |
| 31 | + dropdownProps: { mode: 'BADGE', showBadgeDot: true }, |
| 32 | + }, |
| 33 | + { |
| 34 | + title: 'Customized Multiple Select Badge Mode', |
| 35 | + description: 'Multiple select example - with badges', |
| 36 | + multiple: true, |
| 37 | + dropdownProps: { |
| 38 | + mode: 'BADGE', |
| 39 | + showBadgeDot: false, |
| 40 | + badgeDotStyle: {}, |
| 41 | + badgeColors: '#d5c4a1', // Badge Colors currentlly overwites badgeStyle background color |
| 42 | + placeholderStyle: { color: '#83a598' }, |
| 43 | + badgeStyle: { |
| 44 | + // background: '#d5c4a1', |
| 45 | + borderColor: '#282828', |
| 46 | + borderWidth: 2, |
| 47 | + borderStyle: 'solid', |
| 48 | + }, |
| 49 | + badgeTextStyle: { |
| 50 | + color: '#282828', |
| 51 | + }, |
| 52 | + style: { |
| 53 | + backgroundColor: '#fbf1c7', |
| 54 | + borderColor: '#b16286', |
| 55 | + cursor: 'pointer', |
| 56 | + }, |
| 57 | + customItemContainerStyle: {}, |
| 58 | + listItemContainerStyle: { |
| 59 | + backgroundColor: '#fbf1c7', |
| 60 | + borderColor: '#b16286', |
| 61 | + }, |
| 62 | + listItemLabelStyle: { |
| 63 | + color: '#b16286', |
| 64 | + }, |
55 | 65 | }, |
56 | | - listItemLabelStyle: { |
57 | | - color: '#b16286' |
| 66 | + }, |
| 67 | + { |
| 68 | + title: 'Autoscroll Example', |
| 69 | + description: 'This is the default dropdown picker - with autoscroll', |
| 70 | + dropdownProps: { autoScroll: true }, |
| 71 | + }, |
| 72 | + { |
| 73 | + title: 'Searchable Example', |
| 74 | + description: 'This is the default dropdown picker - with search', |
| 75 | + dropdownProps: { searchable: true }, |
| 76 | + }, |
| 77 | + { |
| 78 | + title: 'Multiple Search Example', |
| 79 | + description: 'This is the default dropdown picker - with search', |
| 80 | + multiple: true, |
| 81 | + dropdownProps: { searchable: true }, |
| 82 | + }, |
| 83 | + { |
| 84 | + title: 'Multiple Search Clear on Select Example', |
| 85 | + description: 'This is the default dropdown picker - with search', |
| 86 | + multiple: true, |
| 87 | + dropdownProps: { |
| 88 | + searchable: true, |
| 89 | + clearSearchFieldOnSelect: true, |
| 90 | + mode: 'BADGE', |
58 | 91 | }, |
59 | 92 | }, |
60 | | -},{ |
61 | | - title: "Autoscroll Example", |
62 | | - description: "This is the default dropdown picker - with autoscroll", |
63 | | - dropdownProps: {autoScroll: true}, |
64 | | -},{ |
65 | | - title: "Searchable Example", |
66 | | - description: "This is the default dropdown picker - with search", |
67 | | - dropdownProps: {searchable: true}, |
68 | | -},{ |
69 | | - title: "Multiple Search Example", |
70 | | - description: "This is the default dropdown picker - with search", |
71 | | - multiple: true, |
72 | | - dropdownProps: {searchable: true}, |
73 | | -},{ |
74 | | - title: "Multiple Search Clear on Select Example", |
75 | | - description: "This is the default dropdown picker - with search", |
76 | | - multiple: true, |
77 | | - dropdownProps: {searchable: true, clearSearchFieldOnSelect: true, mode: "BADGE"}, |
78 | | -},{ |
79 | | - title: "Modal Example", |
80 | | - description: "This is the default dropdown picker - with search", |
81 | | - multiple: true, |
82 | | - dropdownProps: {listMode: "MODAL"} |
83 | | -}] |
| 93 | + { |
| 94 | + title: 'Modal Example', |
| 95 | + description: 'This is the default dropdown picker - with search', |
| 96 | + multiple: true, |
| 97 | + dropdownProps: { listMode: 'MODAL' }, |
| 98 | + }, |
| 99 | +]; |
84 | 100 |
|
85 | 101 | export default function App(): JSX.Element { |
86 | 102 | const colorScheme = useColorScheme(); |
87 | 103 | const backgroundColor = colorScheme === 'dark' ? '#222' : '#fff'; |
88 | | - |
| 104 | + |
89 | 105 | const renderItem = ({ item }: { item: ExampleProps }) => ( |
90 | | - <DropDownPickerExample |
91 | | - {...item} |
92 | | - /> |
| 106 | + <DropDownPickerExample {...item} /> |
93 | 107 | ); |
94 | 108 |
|
95 | 109 | return ( |
96 | 110 | <GestureHandlerRootView> |
97 | | - <View style={{ |
98 | | - ...styles.page, |
99 | | - backgroundColor, |
100 | | - }}> |
| 111 | + <View |
| 112 | + style={{ |
| 113 | + ...styles.page, |
| 114 | + backgroundColor, |
| 115 | + }}> |
101 | 116 | <FlatList |
102 | 117 | data={EXAMPLES} |
103 | 118 | keyExtractor={(example: ExampleProps) => example.title} |
@@ -127,17 +142,17 @@ const styles = StyleSheet.create({ |
127 | 142 | marginBottom: 64, |
128 | 143 | padding: 3, |
129 | 144 | maxWidth: 600, |
130 | | - minWidth: 400 |
| 145 | + minWidth: 400, |
131 | 146 | }, |
132 | 147 | examplesContainer: { |
133 | 148 | display: 'flex', |
134 | 149 | flexDirection: 'column', |
135 | 150 | justifyContent: 'flex-start', |
136 | | - gap: 32 |
| 151 | + gap: 32, |
137 | 152 | }, |
138 | 153 | exampleCard: { |
139 | | - zIndex:0, |
| 154 | + zIndex: 0, |
140 | 155 | borderRadius: 8, |
141 | | - marginBottom: 48 |
142 | | - } |
| 156 | + marginBottom: 48, |
| 157 | + }, |
143 | 158 | }); |
0 commit comments