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

[RCTTouchHandler] Invert Y coordinate when sending touch events to JS #1862

Merged
merged 1 commit into from
Jun 28, 2023

Conversation

Saadnajmi
Copy link
Collaborator

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

macOS has an inverted Y coordinate for its screen coordinate system compared to other OS'es. This led to a bug where pressIn/pressOut on Pressables was calculated with the wrong rect, and click hold->move mouse out of button rect was doing weird stuff. Also some animation code was off. It's easier to explain with a video:

Screen.Recording.2023-06-27.at.5.40.13.PM.mov

The solution is to flip the Y coordinate in RCTTouchHandler when sending the touch (aka click) event to JS.

Changelog

[MACOS] [FIXED] - nvert Y coordinate when sending to JS in RCTTouchHandler

Test Plan

Tested the same two demos and they work now :)

Screen.Recording.2023-06-27.at.5.37.39.PM.mov

@Saadnajmi Saadnajmi changed the title [RCTTouchHandler] Invert Y coordinate when sending to JS [RCTTouchHandler] Invert Y coordinate when sending touch events to JS Jun 28, 2023
@Saadnajmi Saadnajmi merged commit 0daf75a into microsoft:main Jun 28, 2023
@Saadnajmi Saadnajmi deleted the touch-handler branch August 10, 2023 22:37
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