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 inconsistent behaviour on Android and IOS #16771

Closed
kshube opened this issue Nov 9, 2017 · 4 comments
Closed

zIndex inconsistent behaviour on Android and IOS #16771

kshube opened this issue Nov 9, 2017 · 4 comments
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@kshube
Copy link

kshube commented Nov 9, 2017

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment:
OS: macOS High Sierra 10.13.1
Node: 8.9.1
Yarn: 1.3.2
npm: 5.5.1
Watchman: 4.9.0
Xcode: Xcode 9.1 Build version 9B55
Android Studio: 3.0 AI-171.4408382

Packages: (wanted => installed)
react: 16.0.0 => 16.0.0
react-native: 0.50.3 => 0.50.3

Steps to Reproduce

Create a project with react-native init projectName

  1. Create a Absolute positioned View inside a Relative positioned parent
  2. Provide zIndex to Absolute positioned View.
  3. Create Multiple View of type as mentioned in step 1 in flexDirection: column
  4. The Absolute positioned View will be clipped by the Next Relative positioned View in IOS.

Expected Behavior

On Android the Text component should appear above the below View Component which is correct as per my understanding.
On IOS the Text component should appear above the below View Component. As it happened in Android.

Actual Behavior

On android the Text component appear above the below View Component which is correct as per my understanding.
On IOS the Text component is not shown above the below View Component. The Text component is getting clipped.

Reproducible Demo

https://snack.expo.io/ryqJU3ZJM
https://stackoverflow.com/questions/47200609/react-native-zindex-inconsistent-behaviour-on-android-and-ios

@janicduplessis
Copy link
Contributor

janicduplessis commented Nov 12, 2017

This works on Android because of an optimisation that causes view that are used only for layout (don't contribute to any visual) to be removed. In this case your inputContainer Views get optimized away and make it that all Text and TextInputs are in the same view which makes it work properly. If you disable this optimisation (add a backgroundColor or collapsable=false) you will see that it doesn't work at all on Android because overflow is always hidden (no support for overflow visible currently).

See https://snack.expo.io/H1j2nEUkz

Not sure if there is an easier way to accomplish the effect that you want but I think you will have to make sure all inputs and text components are in the same View, or avoid using absolute positioning but that would make your layout move a bit when showing error messages.

@kshube
Copy link
Author

kshube commented Nov 13, 2017

@janicduplessis Thanks for your input. I understand the behavior now. In Web using HTML, CSS I can accomplish this effect using same markup. Shouldn't there be a support for same in react native.

@stale
Copy link

stale bot commented Jan 12, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 12, 2018
@janicduplessis
Copy link
Contributor

@shubendrak We can't always be 100% compatible with the web because of some platform limitations, but try to be as close as possible.

@facebook facebook locked and limited conversation to collaborators May 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

2 participants