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.

[0.45+] Changing zIndex dynamically not working on Android

See original GitHub issue

Is this a bug report?

Yes

Have you read the Bugs section of the Contributing to React Native Guide?

Yes

Environment

  1. react-native -v:
react-native-cli: 2.0.1
react-native: 0.46.0
  1. node -v: v8.1.3

  2. npm -v: 5.0.3

  3. yarn --version: 0.27.5

  4. Target Platform: both

  5. Development Operating System: macOS Sierra

  6. Build tools: both

Steps to Reproduce

In RN 0.44, I can dynamically change zIndex layout prop for Views on both Android & iOS. But after upgrading to 0.46, only iOS can work as expected, can’t make it work on Android.

Expected Behavior

zIndex could be changed dynamically on Android.

Actual Behavior

Here are screenshot on Android. By tapping on “Change top box” button, it’s expected that red box will overlap green & blue boxes, another tap should make green box overlap the others, and so on. This works on iOS, but not on Android.

zIndex bug on Android

Reproducible Demo

Please see this gist.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:25 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
pqthang97commented, Jul 22, 2017

image I have this problem on 0.45.1 and 0.46.4. I set zIndex of 100, position absolute. It work fine in iOS but not android.

3reactions
9006commented, Jul 14, 2017

hack style: {elevation:0.01,zIndex:999}

Read more comments on GitHub >

github_iconTop Results From Across the Web

zIndex + position:'absolute' breaks with dynamic components ...
When using any kind of zIndex value with position:'absolute', dynamic components (views in an array for example), will fall out of place or...
Read more >
JS-zIndex: Can't change z-index of element dynamically
You should create 2 CSS classes, one called focus and one called unfocus. When you click on your element, you should swap the...
Read more >
4 reasons your z-index isn't working (and how to fix it)
The solution to this is to set position: relative and explicitly set z-index on at least the white block. You could go one...
Read more >
Change z-index dynamically using Javascript - CodePen
You can use the CSS from another Pen by using its URL and the proper URL extension.
Read more >
How To Use Zindex In React-Native - ADocLib
To sum up, most issues with z-index can be solved by following these two guidelines: Check that the elements have their position set...
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