Repository navigation
fix(ScrollView): fix SectionList jumping when sticky headers are enabled fix(ScrollView): forward onCellLayout in ScrollViewStickyHeader - #58954
Conversation
|
Hi @Aditya31032006! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Summary:
Fixes #58925
What's the problem?
When scrolling through a long
SectionListwith sticky headers turned on (stickySectionHeadersEnabled), the list starts glitching and rapidly jumping back and forth between rows once you scroll down a bit.Why does this happen?
ScrollViewStickyHeaderwraps it inside a container.onLayoutfrom the child so the child doesn't measure itself.VirtualizedList(which powersSectionList) doesn't useonLayout—it usesonCellLayout.ScrollViewStickyHeaderonly looked foronLayout, the list item kept its own measurement listener.y = 0(relative to the sticky wrapper) instead of where it actually is on the screen.0as the item's position, got confused about where rows should go, and started jumping back and forth.What is the fix?
ScrollViewStickyHeader, we now also check foronCellLayoutand forward the measurement to it.onCellLayouton the child component so it doesn't accidentally measurey = 0.VirtualizedListCellRendererto describe this behavior accurately.Changelog:
[GENERAL] [FIXED] - Fix SectionList jumping/shaking when sticky headers are enabled
Test Plan:
SectionListwith many items andstickySectionHeadersEnabled={true}.