fix: android pressability issue with measureAsyncOnUI patch#86160
fix: android pressability issue with measureAsyncOnUI patch#86160
Conversation
Add react-native patch based on upstream PR facebook/react-native#51835 to fix Android-specific issue where onPress events do not trigger for Pressable components when used inside a Tooltip on certain Samsung devices. Also removes the createPressHandler workaround since this patch properly fixes the root cause. Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@MelvinBot We're seeing the error _NativeDOM.default.measureAsyncOnUI is not a function on iOS. |
🔍 Analysis:
|
|
@MelvinBot please apply the fix |
… methodMap_ On iOS, codegen for FBReactNativeSpec is skipped when pre-generated files exist in node_modules. The original patch modified NativeDOM.js and the C++ implementation but did not update the pre-generated FBReactNativeSpecJSI.h, causing measureAsyncOnUI to be undefined at runtime on iOS. This commit: 1. Patches FBReactNativeSpecJSI.h to add measureAsyncOnUI to the NativeDOMCxxSpec methodMap_ and adds the static invoker function 2. Adds a defensive typeof guard in ReactNativeElement.measureAsyncOnUI to fall back to regular measure() if the native method is unavailable Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
|
Fixed the iOS Changes:
Please rebuild the iOS app and verify the error is resolved. |
|
@MelvinBot The workflows failing |
The second hunk of the FBReactNativeSpecJSI.h section had a line count mismatch in its @@ header (declared 6 old/15 new but only contained 5 old/14 new lines), causing patch-package to fail with a parse error during npm postinstall. Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
|
Fixed the failing checks: the |
|
I checked the workflow status. The only failing check is All other checks (ESLint, typecheck, tests, builds, etc.) are still pending — they're currently running. There are no actual failures to fix yet. If any checks fail after they complete, feel free to tag me again and I'll investigate. |
|
The previous check failures (TypeScript, ESLint, unused styles) were all caused by the same issue: the patch file This was already fixed in commit The only failing check is |
|
🚧 @MonilBhavsar 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! 🧪🧪
|
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 measurementFabricUIManager→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))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