-
Notifications
You must be signed in to change notification settings - Fork 132
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
Fix invalid onScroll events breaking FlatList #1873
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not obvious from the description, but how did this break Flatlist? This is separate from the general "Flatlist is slow on macOS" issue, right?
We encountered issues in product code where dynamic content loading was implemented using a FlatList and tracking the scroll position. Because the scroll view was emitting scroll events while the view frame was still being set, the FlatList would receive an incorrect scroll event with a 0 height which was breaking the virtual rendering.
It is a separate issue. Here it was happening at mount and resize time. |
My bad for close/open.. finger slipped. |
Absolutely! I'll submit another bug fix PR and then bring both changes over to 0.71. |
Co-authored-by: Nick <lefever@meta.com>
Please select one of the following
Summary
RCTScrollView
was submittingonScroll
events after anonContentSizeChanged
event. This was caused by thesetFrame
call leading to aDocumentViewBoundsChanged
notification that would get triggered a second time after the horizontal/vertical scrollers would be enabled/disabled.This double notification would trigger a
scrollViewDidScroll
call with anonScroll
event being sent because the scroll position would toggle temporarily due to the scrollers being shown/hidden.This PR updates the scroll view to compare the scroll position with the last sent position after the scrollers were set. This fixes the wrong
onScroll
event during thesetFrame
because the scroll position is stable and valid by the time we do the comparison.Changelog
[macOS] [FIXED] - Update ScrollView to emit only valid onScroll events
Test Plan
Tested by running RNTester on macOS with paper and using the FlatList examples.