[Pressable] Mouse drags inside Pressable don't move the window #1857
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WIP, there's still some test code laying around.
Please select one of the following
Summary
When you host RN inside a window with a movable background, we don't want clicks inside Buttons/Controls/Pressables to move the window. We instead want to be able to click and drag off the Button to "cancel" the mouse interaction.This matches native Appkit controls. There's a convenient prop on NSView to do this, mouseDownCanMoveWindow, let's just expose it to React Native and set it to false on Pressable (the closest thing we have to an
NSControl
subclass in JS land).Changelog
[MACOS] [FIXED] - Mouse drags inside Pressable don't move the window
Test Plan
Made RNTester's window movable via
[self.window setMovableByWindowBackground:YES];
inside AppDelegate.mm. I then tested dragging the window from inside and outside a Pressable. I compared this to the behavior of dragging NSSwitch (one of the native controls exposed by RN).Screen.Recording.2023-06-20.at.10.58.04.AM.mov