-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
infinite FlatList with inverted prop becomes crazy #1254
Comments
Ouch! I don't think that this is a great way to handle the |
FlatList is a copy of what's in React Native |
Then how come it behave so differently in the browser? |
Ok, I think I can fix it. I'll make a PR. |
This is the pending PR. I will try to fix this problem directly with RN team with this discussion. |
Linking the related issue @Sharcoux created for Yoga facebook/yoga#866 |
I had this issue - some very confusing behaviour with an inverted FlatList on web only. For anyone looking for a workaround |
@sdcooke |
I solved this problem as follows |
Experienced something similar to this. The weird scrolling issue seemed to go away after using the |
I actually found a pretty neat workaround making "inverted lists" work nicely with RNW - even in a shared code environment along with RN. The solution is to achieve the inverted style in a different way with the very same effect. const isWeb = Platform.OS === 'web';
const listStyle: ViewStyle | undefined = isWeb
? { flexDirection: 'column-reverse' }
: undefined;
const contentContainerStyle: ViewStyle | undefined = isWeb
? { flexDirection: 'column-reverse' }
: undefined;
<SectionList
{...otherListProps}
inverted={!isWeb} // <-- do not invert to prevent transform: [{scaleY: -1}]
contentContainerStyle={contentContainerStyle} // <-- 'column-reverse' to make it scroll to the bottom
style={listStyle} // <-- 'column-reverse' to reverse you list array
/> |
@mrsimply onEndReached is not called with this approach. I ended doing this for now:
|
Hey guys! I found the problems that cause this issue and also made PRs to fix them. Check them out and let me know what you think. |
I encountered this issue in an Expo app. When I inspected the element(s) I saw that the list had 2 nested |
Closing this old issue because VirtualizedList/FlatList will be developed exclusively out of the RN monorepo in the future. An open PR will be the last list-related change to be made to RNW, and should fix this. There may still be an issue in other code that's part of RNW, so feel free to create a new issue with latest info if needed. |
The problem
When loading many items in a FlatList with the
inverted
prop, the list gets weird behaviours. The scroll moves on its own. It is also reverted whereas it shouldn't, and to top it all, some elements of the list gets inaccessible...How to reproduce
Simplified test case
Steps to reproduce:
Expected behavior
If you remove the
inverted
prop, you get the expected behaviour.inverted
should just make the items of the list to be displayed from bottom to top andonEndReached
to be called when reaching the top.Environment (include versions). Did this work in previous versions?
The text was updated successfully, but these errors were encountered: