Skip to content

Keep scrollAwayPaddingBottom in ScrollView state on Android - #59655

Open
lazerg wants to merge 1 commit into
react:mainfrom
lazerg:fix/issue-59654-scroll-away-padding-bottom
Open

lazerg wants to merge 1 commit into
react:mainfrom
lazerg:fix/issue-59654-scroll-away-padding-bottom

Conversation

@lazerg

@lazerg lazerg commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

With useTraitHiddenOnAndroid or enableViewCulling on, mounting a ScrollView on Android crashes with NoSuchKeyException: scrollAwayPaddingBottom. loadFabricScrollState reads scrollAwayPaddingBottom from the state data, but the C++ ScrollViewState never had that field, so getDynamic() doesn't include it and the value Kotlin writes in forceUpdateState gets dropped on the way back.

This adds scrollAwayPaddingBottom to ScrollViewState and reads/writes it in the serializable state, the same way scrollAwayPaddingTop already works.

Fixes #59654

Changelog:

[ANDROID] [FIXED] - Fix ScrollView crash with NoSuchKeyException: scrollAwayPaddingBottom when useTraitHiddenOnAndroid or enableViewCulling is on

Test Plan:

Added a ScrollViewStateTest case (under RN_SERIALIZABLE_STATE) checking that getDynamic() includes scrollAwayPaddingBottom and that it survives a round trip through the dynamic constructor. I ran it locally against the header with Homebrew folly and gtest:

clang++ -std=c++20 -DRN_SERIALIZABLE_STATE ... ScrollViewState.cpp -lgtest -lgtest_main -lfolly
[  PASSED  ] 1 test.

Without the fix it doesn't compile, since the field doesn't exist. I updated the three Frameworks C++ API snapshots by hand and checked them against python -m scripts.cxx-api.parser --validate output for ScrollViewState. I also ran the repo's clang-format on both files. I didn't run the reproducer app on a device.

@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 30, 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 30, 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.

Android: ScrollView crashes on mount with NoSuchKeyException: scrollAwayPaddingBottom when useTraitHiddenOnAndroid is on

1 participant