Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Nov 29, 2024

Conversation

Saadnajmi
Copy link
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 Lefever and 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 Saadnajmi requested a review from a team as a code owner November 21, 2024 17:55
@Saadnajmi Saadnajmi merged commit a9c8649 into microsoft:main Nov 29, 2024
14 checks passed
@Saadnajmi Saadnajmi deleted the fabric/coordinates branch November 29, 2024 12:30
Sign up for free to 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