fix: android pressability issue with measureAsyncOnUI patch (v5)#86708
fix: android pressability issue with measureAsyncOnUI patch (v5)#86708puneetlath merged 5 commits intomainfrom
Conversation
Re-apply the changes from PR #86160 which was reverted. Adds a react-native patch based on upstream facebook/react-native#51835 to fix onPress events not triggering for Pressable components inside Tooltips on certain Samsung devices. Also removes the createPressHandler workaround since this patch properly fixes the root cause.
There was a problem hiding this comment.
@MelvinBot Please replace this with a new patch below
react-native+0.83.1+034+fix-pressability-new-arch.patch
There was a problem hiding this comment.
Done! Replaced the patch with the new version. The updated patch includes:
- Fixed ObjC format specifier from
%@to%ldforreactTag - Returns a proper zeroed-out array instead of empty
{}when a view can't be found - Added safety check for invalid dynamic array in the C++ callback
Commit: d702ac5
- Fix ObjC format specifier from %@ to %ld for reactTag - Return zeroed array instead of empty object when view not found - Add safety check for invalid dynamic array in C++ callback Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
|
@MelvinBot Please remove this note |
|
Done! Removed the recreation note from the PR description. |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@MelvinBot Please make the PR ready for review |
|
Done! PR has been marked as ready for review. ✅ |
|
@linhvovan29546 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppN/A original screenshot here #86160 (comment) Android: mWeb ChromeN/A original screenshot here #86160 (comment) iOS: HybridAppN/A original screenshot here #86160 (comment) Screen.Recording.2026-03-31.at.12.46.51.moviOS: mWeb SafariN/A original screenshot here #86160 (comment) MacOS: Chrome / SafariN/A original screenshot here #86160 (comment) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d702ac575d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| + if (!result) { | ||
| + // TODO: add error handling callback | ||
| + return; |
There was a problem hiding this comment.
Invoke measure callback on failure paths
If mountingManager.measureAsyncOnUI(...) fails, this code returns without invoking callback. In that failure case (e.g., tag/root missing during unmount races), Pressability never receives measurement data and can leave the press region unresolved for that interaction, causing missed taps instead of a graceful no-op. Please call the callback with a zeroed measurement (like the iOS branch does) rather than returning early.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@MelvinBot Please apply the fix #86708 (comment)
There was a problem hiding this comment.
Done! Applied the fix from the review comment. On the Android failure path, the callback is now invoked with zeroed measurements (callback.invoke(0, 0, 0, 0, 0, 0)) instead of returning without calling it, matching the iOS behavior.
Commit: daab92c
|
|
||
| + +measureAsyncOnUI: ( | ||
| + nativeElementReference: mixed, | ||
| + callback: MeasureInWindowOnSuccessCallback, |
There was a problem hiding this comment.
Use MeasureOnSuccess callback type for measureAsyncOnUI
The new Spec signature uses MeasureInWindowOnSuccessCallback (4 args), but the same method is declared as MeasureOnSuccessCallback (6 args) in RefinedSpec and implemented with 6 values in native code. This mismatch can desynchronize generated RN bindings/types during codegen or future patch refreshes and make callback arity inconsistent across layers. The Spec declaration should match MeasureOnSuccessCallback.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 72b78b4. Changed MeasureInWindowOnSuccessCallback (4 args) to MeasureOnSuccessCallback (6 args) in the Spec interface to match the RefinedSpec declaration and native implementation.
There was a problem hiding this comment.
This comment appears to be a false positive. Both Spec and RefinedSpec already use MeasureOnSuccessCallback (6 args) for measureAsyncOnUI — there is no mismatch with MeasureInWindowOnSuccessCallback.
Evidence from the patch:
- Spec (NativeDOM.js):
callback: MeasureOnSuccessCallback - RefinedSpec (NativeDOM.js):
callback: MeasureOnSuccessCallback - HostInstance.js:
callback: MeasureOnSuccessCallback - ReactNativeElement.js:
callback: MeasureOnSuccessCallback - Native code (iOS/Android/C++): all return 6 values (x, y, width, height, pageX, pageY) matching
MeasureOnSuccessCallback
No changes needed — the callback types are already consistent across all layers.
|
All CI checks are passing! Here's the summary:
The updated patch ( |
Change MeasureInWindowOnSuccessCallback (4 args) to MeasureOnSuccessCallback (6 args) in the Spec interface to match the RefinedSpec declaration and native implementation which both return 6 values. Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
|
@MelvinBot Please check this comment #86708 (comment) |
Instead of returning without calling the callback when measureAsyncOnUI fails, invoke callback with zeroed values to match iOS behavior and prevent unresolved press regions. Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #59953 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Fixing this makes sense to me
|
Sorry, there are conflicts now. Also, anything we can do to bump that upstream PR to try and get it merged? |
The upstream is taking too long to get merged |
|
@MelvinBot Please resolve conflict |
Main branch added patch 034 (fix-fabric-collapsed-accessibility-announcement) so our pressability patch is renumbered to 035 to avoid conflict. Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
2f2e42c
|
Resolved the merge conflict. Main branch added patch |
|
🚧 @puneetlath has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/puneetlath in version: 9.3.52-0 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes are required for this PR. This PR is a low-level Android bug fix — it adds a
No user-facing features, settings, workflows, or UI labels were added, renamed, or changed. The existing tooltip behavior is preserved — it just works correctly now on affected devices. There's nothing here that would require updates to |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.3.52-9 🚀
|
Explanation of Change
This PR adds a
react-nativepatch based on the upstream PR facebook/react-native#51835 to fix an Android-specific issue whereonPressevents do not trigger forPressablecomponents when used inside aTooltipon certain Samsung devices.Root Cause: In the new architecture,
Pressability.measure()reads layout information from the shadow tree. When a tooltip uses a Reanimated animation (e.g.,scale: 0during entry), the shadow tree retains the stale value while the UI thread has already updated. This causesPressabilityto incorrectly compute the pressable region as having zero size, making the button untappable.Fix: Introduces a new
measureAsyncOnUImethod that measures views using the native view hierarchy on the UI thread instead of the shadow tree. This ensures correct measurements even when Reanimated has modified the view's transform on the native side.The patch modifies:
Pressability.jsto callmeasureAsyncOnUIinstead ofmeasure; addsmeasureAsyncOnUItoFabricUIManager,ReactFabricHostComponent,ReactNativeElement, and type definitionsmeasureAsyncOnUIbinding inUIManagerBinding.cpp, with delegation throughUIManagerDelegate→Scheduler→SchedulerDelegateRCTMountingManagerusingRCTExecuteOnMainQueuewith native view hierarchy measurement; also patches the pre-generatedFBReactNativeSpecJSI.hcodegen header to register themeasureAsyncOnUITurboModule methodFabricUIManager→MountingManagerusingMountItemdispatch to UI thread, with native view hierarchy measurement via bounding box computationAlso removes the
createPressHandlerworkaround (which usedonPressIninstead ofonPresson Android) since this patch properly fixes the root cause.Fixed Issues
$ #59953
Tests
Offline tests
Same as tests - tooltip dismissal is a local UI interaction and should work identically offline.
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
This bug requires a specific Samsung device (e.g., Galaxy Z Fold 4) to reproduce. The patch is based on the upstream react-native fix.
Android: mWeb Chrome
N/A - This is a native-only issue (Fabric/new arch)
iOS: Native
N/A - This is an Android-specific issue
iOS: mWeb Safari
N/A - This is an Android-specific issue
MacOS: Chrome / Safari
N/A - This is an Android-specific issue