Skip to content

fix(fabric): Add conditional coordinate space conversion for native view hit testing - #2291

Merged
Saad Najmi (Saadnajmi) merged 3 commits into
microsoft:mainfrom
Saadnajmi:fabric/coordinates
Nov 29, 2024
Merged

fix(fabric): Add conditional coordinate space conversion for native view hit testing#2291
Saad Najmi (Saadnajmi) merged 3 commits into
microsoft:mainfrom
Saadnajmi:fabric/coordinates

Conversation

@Saadnajmi

Copy link
Copy Markdown
Collaborator

This is part of a series of PRs where we are cherry-picking fixes from #2117 to update our Fabric implementation on macOS.

Summary:

Unlike UIKit, AppKit hit testing requires the point to be in the superview coordinate system. As such, we have to override hit testing in React Native macOS to match the assumed iOS semantics.

Followup change I made to the original commit: I removed the RCTView import/check for hit testing in RCTViewComponentView because I don't think we'll ever be moving paper and fabric views like that.

Test Plan:

CI should pass, maybe also try picking 71fae19 and see if selection works now

Nick Lefeverand others added 2 commits November 21, 2024 09:50
…hit testing
Summary:
Native views use the AppKit api for hit testing which requires the point to be in the superview coordinate system.
This diff updates the hit testing in `RCTViewComponentView` to conditionally converts the point to the target view coordinate system only if the tested view is a react view.
Test Plan:
Run Zeratul with Fabric and select text inside message bubbles. The scroll view being a native view, the hit testing does not require a point conversion. With this change, the text selection works as expected.
| Before | After |
|--|
| https://pxl.cl/3Mlpb | https://pxl.cl/3MllN |
Reviewers: shawndempsey, #rn-desktop
Reviewed By: shawndempsey
Differential Revision: https://phabricator.intern.facebook.com/D51129375
Tags: uikit-diff
@Saadnajmi
Saad Najmi (Saadnajmi) merged commit a9c8649 into microsoft:mainNov 29, 2024
@Saadnajmi
Saad Najmi (Saadnajmi) deleted the fabric/coordinates branch November 29, 2024 12:30
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@Saadnajmi@tido64