Skip to content

Fix sticky header presses with shifted measurements#57052

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

Fix sticky header presses with shifted measurements#57052
sorinc03 wants to merge 1 commit into
facebook:mainfrom
sorinc03:fix/android-sticky-header-pressability

Conversation

@sorinc03
Copy link
Copy Markdown
Contributor

@sorinc03 sorinc03 commented Jun 2, 2026

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

1 participant