Repository navigation
Conversation
3a829f7 to
9255850
Compare
|
nice! is any good work around until that improvement is merged ? |
|
Please, take a look to this one 🙏 |
|
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. |
|
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. |
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