Skip to content

fix(ScrollView): fix SectionList jumping when sticky headers are enabled fix(ScrollView): forward onCellLayout in ScrollViewStickyHeader - #58954

Open
Aditya31032006 wants to merge 1 commit into
react:mainfrom
Aditya31032006:fix/sticky-header-on-cell-layout
Open

Aditya31032006 wants to merge 1 commit into
react:mainfrom
Aditya31032006:fix/sticky-header-on-cell-layout

Conversation

@Aditya31032006

@Aditya31032006 Aditya31032006 commented Oct 8, 2026 •

Copy link
Copy Markdown

Summary:

Fixes #58925

What's the problem?

When scrolling through a long SectionList with 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?

  1. When a header becomes sticky, ScrollViewStickyHeader wraps it inside a container.
  2. It is supposed to handle measuring the header's position and pass that measurement along to the list. To do this, it removes onLayout from the child so the child doesn't measure itself.
  3. However, VirtualizedList (which powers SectionList) doesn't use onLayout—it uses onCellLayout.
  4. Because ScrollViewStickyHeader only looked for onLayout, the list item kept its own measurement listener.
  5. Inside the wrapper, the item measured its position as y = 0 (relative to the sticky wrapper) instead of where it actually is on the screen.
  6. The list stored 0 as the item's position, got confused about where rows should go, and started jumping back and forth.

What is the fix?

  • In ScrollViewStickyHeader, we now also check for onCellLayout and forward the measurement to it.
  • We clear onCellLayout on the child component so it doesn't accidentally measure y = 0.
  • Updated the comments in VirtualizedListCellRenderer to describe this behavior accurately.

Changelog:

[GENERAL] [FIXED] - Fix SectionList jumping/shaking when sticky headers are enabled

Test Plan:

  1. Create a SectionList with many items and stickySectionHeadersEnabled={true}.
  2. Scroll down past a few headers.
  3. Before: The list shakes/jumps back and forth between two sets of rows.
  4. After: The list scrolls smoothly with no jumping or flickering.

@meta-cla

meta-cla Bot commented Oct 8, 2026

Copy link
Copy Markdown

Hi @Aditya31032006!

Thank you for your pull request and welcome to our community.

Action Required

In 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.

Process

In 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 CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla

meta-cla Bot commented Oct 8, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 8, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 8, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SectionList with sticky section headers jumps back and forth

1 participant