Skip to content

Conversation

tomekzaw
Copy link
Member

@tomekzaw tomekzaw commented Jun 17, 2025

Summary

This PR fixes sticky header on both Android and iOS.

Together with @bartlomiejbloniarz we found out that sticky header issue can be fixed by commenting out // isPaused_ = true; line. However, this can lead to starvation of commits coming from React. So the best workaround so far is to pause Reanimated commits only in ReanimatedCommitHook only for commits coming from React and skip pausing them for other commits like state updates after scroll.

Note that this PR uses the new signature of shadowTreeWillCommit method which is available from RN 0.80.

ScreenRecording_06-17-2025.13-15-51_1.MP4

@tomekzaw tomekzaw marked this pull request as ready for review June 17, 2025 14:28
@tomekzaw tomekzaw added this pull request to the merge queue Jun 17, 2025
Merged via the queue into main with commit f8fb888 Jun 17, 2025
16 checks passed
@tomekzaw tomekzaw deleted the @tomekzaw/fix-sticky-header branch June 17, 2025 15:00
MatiPl01 pushed a commit that referenced this pull request Jun 26, 2025
<!-- Thanks for submitting a pull request! We appreciate you spending
the time to work on these changes. Please follow the template so that
the reviewers can easily understand what the code changes affect. -->

This PR fixes sticky header on both Android and iOS.

Together with @bartlomiejbloniarz we found out that sticky header issue
can be fixed by commenting out `// isPaused_ = true;` line. However,
this can lead to starvation of commits coming from React. So the best
workaround so far is to pause Reanimated commits only in
`ReanimatedCommitHook` only for commits coming from React and skip
pausing them for other commits like state updates after scroll.

Note that this PR uses the new signature of `shadowTreeWillCommit`
method which is available from RN 0.80.

<video
src="https://github.com/user-attachments/assets/ad36b502-88c5-4215-9ee6-51c26e9bb05c"
alt="after" />

<!-- Provide a minimal but complete code snippet that can be used to
test out this change along with instructions how to run it and a
description of the expected behavior. -->
MatiPl01 added a commit that referenced this pull request Jun 26, 2025
Cherry-pick of the #7668

---------

Co-authored-by: Tomasz Zawadzki <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Jul 23, 2025
## Summary

This PR reverts the conditional skip of reanimated commits (#7668). This
breaks sticky headers, but fixes starvation issues, that would manifest
on C++ state updates.

To fix the stick header one must use the
`DISABLE_COMMIT_PAUSING_MECHANISM` feature flag in reanimated and the
`preventShadowTreeCommitExhaustionWithLocking` in react-native.

## Test plan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants