Skip to content

Fix sticky header presses with shifted measurements - #57052

Open
sorinc03 wants to merge 1 commit into
react:mainfrom
sorinc03:fix/android-sticky-header-pressability
Open

sorinc03 wants to merge 1 commit into
react:mainfrom
sorinc03:fix/android-sticky-header-pressability

Conversation

@sorinc03

@sorinc03 sorinc03 commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #51763.

Pressability measures the responder region when a press starts and later uses that region to decide whether moves/releases remain inside the press rect. In Fabric Android sticky-header scenarios, native measurement can report the responder's layout-space page coordinates while the touch is in the transformed visual position. That makes Pressability think the touch moved outside the responder, so onPressIn fires but onPress is dropped.

This records the initial touch's local coordinates before measuring and, when the measured region does not contain that initial touch, derives the visual region from pageX/pageY - locationX/locationY. Normal move-out cancellation is preserved because the correction is only used when the initial measured rect is inconsistent with the touch that granted the responder.

Changelog:

[ANDROID] [FIXED] - Keep Pressability active when transformed sticky header measurements are shifted from the visual touch position

Test Plan

  • yarn jest packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js --runInBand
  • yarn flow-check
  • yarn eslint --max-warnings 0 packages/react-native/Libraries/Pressability/Pressability.js packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js
  • npx prettier --check packages/react-native/Libraries/Pressability/Pressability.js packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js
  • git diff --check

@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 Jun 2, 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 Jun 2, 2026
@sorinc03
sorinc03 force-pushed the fix/android-sticky-header-pressability branch from 3a829f7 to 9255850 Compare June 4, 2026 08:18
@vovakovalchukk

Copy link
Copy Markdown

nice! is any good work around until that improvement is merged ?

@jiroscripts

Copy link
Copy Markdown

Please, take a look to this one 🙏

@sorinc03

Copy link
Copy Markdown
Contributor Author

There is no separately validated prop-level workaround from my side yet. The available workaround is to apply this PR's two-file Pressability change locally (for example with your usual dependency patch tooling), then verify the affected sticky header on the React Native version you ship. Please also check dragging out of the press target still cancels the press, since preserving that behavior is part of the fix.

This is still awaiting upstream review/import and has not landed. The checks on the current PR commit are green apart from the queued Meta Import Status; that does not replace testing the patch against your app/version.

@kashmiry

Copy link
Copy Markdown

I hit this on android physical device running React Native 0.87.1 and seems even older versions affected. Once the FlatList header pinned, the button still showed a ripple, but onPress never fired. I applied this PR as a Yarn patch and taps now work. Thank you for the fix.
Hope it gets merged soon.

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.

Sticky headers in FlatList/ScrollView become non-touchable after upgrading to 0.79.2

4 participants