question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dropdown getting behind the other Views even with a higher zIndex value

See original GitHub issue

React Native version: 0.64 react-native-dropdown-picker: 5.1.7

Dropdown is working fine on an Android device but while running it on an iOS device it is not respecting the zIndex value:

dropdown

My code for dropdown:

<DropDownPicker
        style={{
          borderTopLeftRadius: 17,
          borderTopRightRadius: 17,
          borderBottomLeftRadius: 17,
          borderBottomRightRadius: 17,
          backgroundColor: '#99ccff',
          height: 35,
        }}
        containerStyle={{
          width: 110,
          marginTop: 10,
          ...containerStyle,
        }}
        itemStyle={{
          flexDirection: 'row',
          justifyContent: 'flex-start',
        }}
        textStyle={{
          fontSize: 10,
          fontWeight: '500',
        }}
        selectedItemLabelStyle={{
          color: '#0066cc',
        }}
        arrowIconStyle={{
          marginVertical: -3,
          paddingTop: 0,
          paddingBottom: 0,
        }}
        zIndex={999999}
        min={5}
        items={items}
        onChangeValue={handleChange}
        searchable={false}
        open={isOpen}
        value={value}
        listMode="SCROLLVIEW"
        setOpen={setIsOpen}
        setValue={setValue}
        onOpen={() => setDropDownOpen(true)}
        onClose={() => setDropDownOpen(false)}
        ref={dropDownRef}
        {...props}
      />

I tried giving the view a negative z-index but that did not help either

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
hossein-zarecommented, May 12, 2021
<View style={Platform.OS !== "android" && {zIndex: 999999}}>
  <Dropdown items={product} selection={handleSelection} />
</View>
0reactions
shubhambattoocommented, May 13, 2021

Going with the MODAL type of dropdown for the iOS version for now, not able to get the zIndex issue resolved. Closing the issue as i think something is missing from my end as the snack worked correctly on iOS.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS: Dropdown menu gets hidden behind the content
I can confirm the menu is there, but it gets hidden behind the underlying content even though it has an absolute position with...
Read more >
4 reasons your z-index isn't working (and how to fix it)
Solution: Move the modal outside of the content parent, and into the main stacking context of the page. ... Now, the modal element...
Read more >
Diagnosis: z-index (submenu hidden behind content)
z-index values are relative to their element's siblings only; outside of that parent container, they have no effect. So if Element B is...
Read more >
picker beeing rendered below other components #148 - GitHub
I went through the source code and added high z-index values of like 1000 to everything in the render method and that did...
Read more >
Using z-index - CSS: Cascading Style Sheets - MDN Web Docs
If several elements share the same z-index value (i.e., they are placed on the same layer), stacking rules explained in the section Stacking ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found