Fix sticky header presses with shifted measurements#57052
Open
sorinc03 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
onPressInfires butonPressis 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 --runInBandyarn flow-checkyarn eslint --max-warnings 0 packages/react-native/Libraries/Pressability/Pressability.js packages/react-native/Libraries/Pressability/__tests__/Pressability-test.jsnpx prettier --check packages/react-native/Libraries/Pressability/Pressability.js packages/react-native/Libraries/Pressability/__tests__/Pressability-test.jsgit diff --check