-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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 in a List #18616
Comments
I was about to open a proposal on this, but might be better to just discuss in this issue. I came across the same problem and worked around it by adding an additional Setting the Happy to put in a PR if this seems like an acceptable solution. @TheNoim For the time being you could use patch-package to make the same change in this commit: https://github.com/mattmcdonald-uk/react-native/commit/a59888b9b68698985b784b6ee29a80c9b878e28d |
@mattmcdonald-uk Thanks for the solution, but I can't use it. I tried to modify your attempt (mattmcdonald-uk/react-native@a59888b). In my example repo I use a wrapper component which can't have the cellStyle prop and I tried to access the applied style with other methods, but I failed. It is a workaround but not a final solution. This should really get fixed. Off topic: react-native-bot 1, @hramos 0 :D Just kidding. |
Having the same issue here |
Will we ever get a fix for this? I mean, this is the second issue about this and still: nothing |
As far as I can tell, no PRs have been submitted to address this issue. I'm adding the Help Wanted tag to surface the issue more broadly. |
This comment has been minimized.
This comment has been minimized.
No need to override any React Native internals to set <FlatList
data={timeline}
renderItem={this.getItemView}
CellRendererComponent={({ children, index, style, ...props }) => {
const cellStyle = [
style,
// I want each item to have a higher zIndex than the previous one,
// in reversed order due to the FlatList being inverted
{ zIndex: this.state.timeline.length - index }
]
// OverflowableView for Android...
return (
<OverflowableView style={cellStyle} index={index} {...props}>
{children}
</OverflowableView>
)
}}
inverted /> |
@Haraldson It could solve my exact case (Not tested), but the not the core problem with zIndex in a List. |
@Haraldson That workaround looks reasonable, but unfortunately when I override |
@isaachinman I don’t quite get the problem? |
@Haraldson Let me explain. Generally speaking, I am attempting to animate the reorder of items within a The problem I've run into is that depending on the direction an item is moving (up or down), it will animate behind the other items, as it is after them in the literal JSX order. So, I want to increase the zIndex/elevation of an item just when it is animating. Which is how I arrived at this thread. Here's the same example, but using the most basic version of your Even if I only return children directly, the animation breaks due to full re-renders of everything. Hopefully this is clear... I have no idea what's going on here. |
I think this issue should definitely get fixed. A workaround would be ok, but I would prefer something by the core team of rn. |
Hello there 👋 this issue seems to have been inactive for the past few months. Because of this, it's likely that the issue is not a high priority anymore or it has been solved by OP; for these reasons, we'll close it. But please, if it's actually still an issue with 0.59 please comment below and we can reopen it or please send us a Pull Request with a fix 😊 |
@kelset Issue still persists. |
Can you submit a repro? |
I did. In the initial issue. I updated the repo. |
The one submitted above is using RN 0.54 (https://github.com/TheNoim/zIndexBug/blob/3e36101903ab96841ba4841e6db214cb4a7df50e/package.json#L18)- as I mentioned when I closed the issue, we'd need one with 0.59 |
went through the hassle and updated to 0.59 |
@kelset I proved, it is still an issue. Please reopen it again. |
sorry, I've missed the other comment. Reopening. |
@kelset Hello. Could you tell me please, what we can do with issue? I`m trying to make this case in android and I have bad result - the ScrollView is under it.... () |
@KassoBrapik Not sure if this is the same issue. |
@TheNoim is there any way to position fix element inside ScrollView ? |
This comment has been minimized.
This comment has been minimized.
the example is based on rn 0.54.3 https://github.com/TheNoim/zIndexBug/blob/rn/package.json#L18 There is another example based on rn 0.59 https://github.com/TheNoim/zIndexBug/blob/master/package.json#L12 I am not sure if the original issue reproduces on latest react-native version and on android, there are several workaround for fixing zIndex issues and they can be adopted in this use case. |
I tried to test the above issue in the react native master branch. During the implementation of the example I noticed that @TheNoim added dependencies like |
This particular code causes a crash on android react native 62.2... So its no longer a valid workaround. |
This workaround worked as I expected, but when I do this onEndReached is not called, so FlatList doesn't load more data. Here is my code:
|
Couldn't make this workaround work on Android without also having |
It's working, thank you. |
This is actually a reopen of my #16878 issue. I've got some thumbs up, so I think I am not the only one with this issue. This time I updated my example project to a pure rn project with the latest release (rn Branche)
Environment
Steps to Reproduce
Expected Behavior
I expect that the component with the high zIndex is over every other component.
Actual Behavior
It seems like it ignores the zIndex property. The behavior is exactly like I would not apply any zIndex. I can remove the zIndex and I get the same result.
Google Drive Link to a screenshot.
Reproducible Demo
Github Demo Project rn Branche This is just an extract out of my current rn project.
Expo Link (Not on the latest rn version)
Google Drive Video which show the issue
The text was updated successfully, but these errors were encountered: