Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zIndex not working #450

Closed
ankit-abylle opened this issue Nov 3, 2021 · 13 comments
Closed

zIndex not working #450

ankit-abylle opened this issue Nov 3, 2021 · 13 comments

Comments

@ankit-abylle
Copy link

I am using this component but the dropdown menu is not showing properly.
image
<DropDownPicker
zIndex={1000}
open={isopen}
value={value}
items={items}
setOpen={setisOpen}
onChangeValue={(value) =>console.log(value)}
setItems={setItems}
setValue={setValue}
dropDownContainerStyle={{ zIndex:10000,backgroundColor:'white',elevation:1000}} />

@ankit-abylle
Copy link
Author

I am using this in expo React native application.

@mikehardy
Copy link
Collaborator

#376

@ankit-abylle
Copy link
Author

Hi @mikehardy Thanks for the reply.
but the other dropdown are different packages that i am replacing currently.
Also I tried removing all other Picker then also its the same .
image

@mikehardy
Copy link
Collaborator

There's a distinct lack of ability to help without a complete example https://stackoverflow.com/help/minimal-reproducible-example

The strategy I showed you can actually toggle the zIndexing of the entire app if needed so I believe it should not matter what other packages you are trying to use

@ankit-abylle
Copy link
Author

@mikehardy Thanks Let me try the above steps you mentioned .
If found issue will create a example.

@KhanhDuy-123
Copy link

<View style={{zIndex: 1000}}>
<DropDownPicker
open={isopen}
value={value}
items={items}
setOpen={setisOpen}
onChangeValue={(value) =>console.log(value)}
setItems={setItems}
setValue={setValue}
dropDownContainerStyle={{ zIndex:10000,backgroundColor:'white',elevation:1000}} />

i succeeded to wrap the view outside @ankit-abylle

@ankit-abylle
Copy link
Author

ankit-abylle commented Nov 23, 2021

@KhanhDuy-123 Thanks for the reply.
I tried with this but faced the same issue . Don't know why zIndex is not working for me.
At last I switched to react-native-picker-select.
This package worked for both android and ios.

@hossein-zare
Copy link
Owner

@ankit-abylle
@KhanhDuy-123 Your solution only works on iOS.

Solution:

const isAndroid = Platform.OS === 'android';

<View style={! isAndroid && {zIndex: 100}}>
  <DropDownPicker
    ...
    dropDownContainerStyle={{backgroundColor:'white'}}
    zIndex={100} />
</View>

<View style={! isAndroid && {zIndex: 50}}>
  <DropDownPicker
    ...
    dropDownContainerStyle={{backgroundColor:'white'}}
    zIndex={50} />
</View>

You should also read https://hossein-zare.github.io/react-native-dropdown-picker-website/docs/tutorials/multiple-pickers

As @mikehardy has said, Consider reproducing your issue in a Snack.

There's a distinct lack of ability to help without a complete example https://stackoverflow.com/help/minimal-reproducible-example

The strategy I showed you can actually toggle the zIndexing of the entire app if needed so I believe it should not matter what other packages you are trying to use

@chuantran3796
Copy link

ios: zIndex, android: elevation. it woking

@ospfranco
Copy link

ospfranco commented May 10, 2022

Even with the wrapping view with zIndex, it doesn't seem to be working for me

Screenshot 000441

Any suggestion how to fix this?

@ospfranco
Copy link

ospfranco commented May 10, 2022

Putting a zIndex value on the bottom one fixes this

@Linh-Vo
Copy link

Linh-Vo commented Mar 13, 2023

still didn't work on IOS

@Everkers
Copy link

In android sit the z-index of the element that you want it to appear above to -1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants