11import React , { JSX } from 'react' ;
2- import { StyleSheet , View , Text , FlatList , useColorScheme } from 'react-native' ;
2+ import { StyleSheet , View , FlatList , useColorScheme } from 'react-native' ;
33import { GestureHandlerRootView } from 'react-native-gesture-handler' ;
44import DropDownPickerExample , { ExampleProps } from './example-src-files/example' ;
55
6- const styles = StyleSheet . create ( {
7- page : {
8- flex : 1 ,
9- } ,
10- container : {
11- flexDirection : 'column' ,
12- margin : 'auto' ,
13- marginTop : 64 ,
14- marginBottom : 64 ,
15- padding : 3 ,
16- maxWidth : 600 ,
17- minWidth : 400
18- } ,
19- examplesContainer : {
20- display : 'flex' ,
21- flexDirection : 'column' ,
22- justifyContent : 'flex-start' ,
23- gap : 32
24- } ,
25- exampleCard : {
26- zIndex :0 ,
27- borderRadius : 8 ,
28- marginBottom : 48
29- }
30- } ) ;
31-
326const EXAMPLES : ExampleProps [ ] = [ {
337 title : "Default Example" ,
348 description : "This is the default dropdown picker"
@@ -71,11 +45,9 @@ export default function App(): JSX.Element {
7145 const backgroundColor = colorScheme === 'dark' ? '#222' : '#fff' ;
7246
7347 const renderItem = ( { item } : { item : ExampleProps } ) => (
74- < View style = { styles . exampleCard } key = { item . title } >
7548 < DropDownPickerExample
7649 { ...item }
7750 />
78- </ View >
7951 ) ;
8052
8153 return (
@@ -86,13 +58,44 @@ export default function App(): JSX.Element {
8658 } } >
8759 < FlatList
8860 data = { EXAMPLES }
89- style = { { zIndex : 0 } }
9061 keyExtractor = { ( example : ExampleProps ) => example . title }
9162 renderItem = { renderItem }
9263 contentContainerStyle = { styles . container }
9364 showsVerticalScrollIndicator = { false }
65+ CellRendererComponent = { ( { index, style, children } ) => (
66+ // Remove flatlsit view that wraps children for dropdown zIndex support
67+ < > { children } </ >
68+ ) }
9469 />
9570 </ View >
9671 </ GestureHandlerRootView >
9772 ) ;
9873}
74+
75+ const styles = StyleSheet . create ( {
76+ page : {
77+ flex : 1 ,
78+ } ,
79+ container : {
80+ position : 'relative' ,
81+ flexDirection : 'column' ,
82+ margin : 'auto' ,
83+ zIndex : 1 ,
84+ marginTop : 64 ,
85+ marginBottom : 64 ,
86+ padding : 3 ,
87+ maxWidth : 600 ,
88+ minWidth : 400
89+ } ,
90+ examplesContainer : {
91+ display : 'flex' ,
92+ flexDirection : 'column' ,
93+ justifyContent : 'flex-start' ,
94+ gap : 32
95+ } ,
96+ exampleCard : {
97+ zIndex :0 ,
98+ borderRadius : 8 ,
99+ marginBottom : 48
100+ }
101+ } ) ;
0 commit comments