Skip to content

fix(fabric): read hitSlop for all ViewKind children in getContentBounds - #60360

Open
asxxb wants to merge 1 commit into
react:mainfrom
asxxb:fix/scrollview-hitslop-overflow
Open

asxxb wants to merge 1 commit into
react:mainfrom
asxxb:fix/scrollview-hitslop-overflow

Conversation

@asxxb

@asxxb asxxb commented Nov 28, 2026

Copy link
Copy Markdown

Summary:

YogaLayoutableShadowNode::getContentBounds() previously read hitSlop only from children whose component handle matched ViewShadowNode::Handle(). Because hitSlop is defined on BaseViewProps, other ConcreteViewShadowNode components such as ScrollView also parse hitSlop, so their hitSlop extending past their parent's box never widened the parent's overflowInset.

Check ShadowNodeTraits::ViewKind instead and read hitSlop from ViewProps, matching how YogaLayoutableShadowNode, PointerEventsProcessor, and LayoutAnimationKeyFrameManager access ViewProps-derived nodes.

Fixes #60278

Changelog:

[GENERAL] [FIXED] - Read hitSlop in YogaLayoutableShadowNode::getContentBounds for all ViewKind children (including ScrollView)

Test Plan:

  • Built and ran react_renderer_components_view_tests (via CMake/Make on macOS arm64 with -lc++abi for libjsi.dylib):
    • 111 tests from 11 test suites ran — 111 passed, including all 7 tests in LayoutTest.* (LayoutTest.overflowInsetScrollViewHitSlopTest passed).
  • yarn eslint --max-warnings 0 packages/react-native/Libraries/Components/ScrollView/__tests__/ScrollView-itest.js — passed.
  • yarn prettier --check packages/react-native/Libraries/Components/ScrollView/__tests__/ScrollView-itest.js — passed.
  • node ./scripts/clang-format.js --check packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp packages/react-native/ReactCommon/react/renderer/components/view/tests/LayoutTest.cpp — passed.
  • yarn flow-check — 0 errors in source/test files (exited 2 locally due to pre-existing .git/logs/refs/remotes/upstream/@chrfalch/prebuild-fix-missing-script-file-in-package.json and .git/refs/remotes/upstream/@chrfalch/prebuild-fix-missing-script-file-in-package.json).
  • Could not run yarn fantom packages/react-native/Libraries/Components/ScrollView/__tests__/ScrollView-itest.js locally (fantom_tester build failed on macOS due to disk space constraints / missing -lc++abi on libjsi.dylib); relying on CI fantom-tests.yml on Linux.

…ds (fix react#60278)

YogaLayoutableShadowNode::getContentBounds() previously only read hitSlop from children whose component handle matched ViewShadowNode::Handle(). Because hitSlop lives on BaseViewProps, other ConcreteViewShadowNode components such as ScrollView also parse hitSlop, so checking ShadowNodeTraits::ViewKind and reading hitSlop from ViewProps ensures their hitSlop widens the parent's overflowInset.
@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 Nov 28, 2026
@github-actions github-actions Bot added the Meta Review Required This PR is considered risky and requires Meta to import it to do more testing before merging. label Nov 28, 2026
@asxxb asxxb changed the title fix(fabric): read hitSlop for all ViewKind children in getContentBoun… fix(fabric): read hitSlop for all ViewKind children in getContentBounds Nov 28, 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 Nov 28, 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. Meta Review Required This PR is considered risky and requires Meta to import it to do more testing before merging. 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.

Fabric: a ScrollView's hitSlop past its parent's box never widens the parent's overflowInset, as getContentBounds reads hitSlop only from a View child

1 participant