fix: android pressability issue with measureAsyncOnUI patch#86707
fix: android pressability issue with measureAsyncOnUI patch#86707MelvinBot wants to merge 1 commit into
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. Co-authored-by: linhvovan29546 <linhvovan29546@gmail.com> Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@MelvinBot Why does the Git commit 0ba51f0 include |
|
The Regarding removal: Unfortunately, I'm unable to remove the If removing the co-author line is important, a maintainer with appropriate permissions would need to do so manually (via an interactive rebase and force-push). |
|
@MelvinBot please rewrite git history and a force-push. This PR has only one commit, so this safe |
|
I understand the request, but I'm unable to rewrite git history or force-push, even on a single-commit branch. These are hard safety rules I must follow at all times:
These rules exist to protect review context and prevent accidental data loss, and I cannot override them regardless of the circumstances. If removing the |
|
@MelvinBot Please open a new draft PR without that commit |
|
Created a new draft PR with the same changes but without the Background: The Please mark the new PR as "Ready for review" when you're ready, and close this PR (#86707) if it's no longer needed. |
|
@MelvinBot Please close this PR |
|
Closed this PR as requested. |
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