Skip to content

Conversation

Saadnajmi
Copy link
Collaborator

@Saadnajmi Saadnajmi commented Aug 11, 2023

Please select one of the following

  • I am removing an existing difference between facebook/react-native and microsoft/react-native-macos 👍
  • I am cherry-picking a change from Facebook's react-native into microsoft/react-native-macos 👍
  • I am making a fix / change for the macOS implementation of react-native
  • I am making a change required for Microsoft usage of react-native

Summary

Back in #1862, we made a fix to make sure that macOS screen coordinates (where the Y coordinate is flipped) are converted before being sent to JS, where we assume the coordinate system that every other platform uses (AKA, origin at top left). @lenaic pointed out there's a simpler way to do this, so let's make a small optimization. To quote:

Using this line to assign rootViewLocation instead of the weird _cachedRootView.window.contentView conversion fixes the flipping, allowing to remove the flipping you added below.

Note, it seems we've changed this particular block before, with #1619 . Seems it's a strongly-hit code path 😄

Changeling

[MACOS] [CHANGED] - Add a small optimization to RCTTouchHandlers' coordinate conversion

Test Plan

Sanity checked the Pressable test page with and without the change and didn't really see a difference.

@Saadnajmi Saadnajmi merged commit f1160c0 into microsoft:main Aug 14, 2023
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