From 80b3be0f8e3d7c9518762fb0dbf4dce2371130e8 Mon Sep 17 00:00:00 2001 From: imdevan Date: Fri, 3 Oct 2025 17:27:46 -0700 Subject: [PATCH] fix: example zindexing --- examples/example-src-files/example.tsx | 103 +++++++++++++++---------- 1 file changed, 61 insertions(+), 42 deletions(-) diff --git a/examples/example-src-files/example.tsx b/examples/example-src-files/example.tsx index 7a725bbc1..cc6957ef5 100644 --- a/examples/example-src-files/example.tsx +++ b/examples/example-src-files/example.tsx @@ -6,9 +6,28 @@ type ExampleProps = { multiple?: boolean; title: string; description?: string; + placeholder?: string; + multipleText?: string; + // For the sake of keeping the examples simple for now + items?: ItemType[]; dropdownProps?: Partial>; }; +const DEFAULT_ITEMS = [ + { label: 'Apple', value: 'apple' }, + { label: 'Banana', value: 'banana' }, + { label: 'Nectarines', value: 'nectarines' }, + { label: 'Kiwis', value: 'kiwis' }, + { label: 'Raspberries', value: 'raspberries' }, + { label: 'Pears', value: 'pears' }, + { label: 'Guava', value: 'guava' }, + { label: 'Grapes', value: 'grapes' }, + { label: 'Manderins', value: 'manderins' }, + { label: 'Pineapple', value: 'pineapple' }, + { label: 'Dragon Fruit', value: 'dragon_fruit' }, + { label: 'Prickly Pear', value: 'prickly_pear' }, +]; + const styles = StyleSheet.create({ title: { fontSize: 24, @@ -21,7 +40,11 @@ const styles = StyleSheet.create({ exampleContainer: { display: 'flex', flexDirection: 'column', - gap: 16 + position: 'relative', + gap: 16, + }, + dropdownContainer: { + zIndex: 1 } }); @@ -35,6 +58,9 @@ export default function DropDownPickerExample({ title, description, dropdownProps, + placeholder = 'Choose a fruit', + multipleText='You have chosen {count} fruits.', + items = DEFAULT_ITEMS, }: ExampleProps): JSX.Element { const [open, setOpen] = useState(false); const [singleValue, setSingleValue] = useState(null); @@ -43,17 +69,13 @@ export default function DropDownPickerExample({ const color = colorScheme === 'dark' ? '#fff' : '#222'; const theme = colorScheme === 'dark' ? 'DARK' : 'LIGHT'; - const [items, setItems] = useState>>([ - { label: 'Apple', value: 'apple' }, - { label: 'Banana', value: 'banana' }, - { label: 'Nectarines', value: 'nectarines' }, - { label: 'Kiwis', value: 'kiwis' }, - { label: 'Raspberries', value: 'raspberries' }, - { label: 'Pears', value: 'pears' }, - ]); - + const [_items, setItems] = useState>>(items); + return ( - + {title} {description && ( @@ -61,37 +83,34 @@ export default function DropDownPickerExample({ )} - - {multiple ? ( - - ) : ( - - )} - - + {multiple ? ( + + ) : ( + + )} {multiple ? 'Fruits currently are: ' : 'Fruit currently is: '}