forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 149
feat(fabric): Implement Drag and Drop on View #2713
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
Merged
Merged
+701
−219
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Summary: Add support for `draggedTypes` to the View component, enabling the configuration of a native view as a drop target. Test Plan: * Run Zeratul with Fabric enabled * Drag a file over the messages view and check that the cursor is changing indicating a drop target https://pxl.cl/4ldkW Reviewers: shawndempsey, #rn-desktop Reviewed By: shawndempsey Subscribers: taskcreeper Differential Revision: https://phabricator.intern.facebook.com/D53674739
Summary: Add the drag and drop event emitters to View with the payload conversion matching the Paper API for dragEnter/dragLeave/drop events. Test Plan: Tested later in this stack. Reviewers: shawndempsey, #rn-desktop Reviewed By: shawndempsey Differential Revision: https://phabricator.intern.facebook.com/D53674738
Summary: Add support for drag and drop to the `ViewComponent` for files and images. The implementation converts the dropped pasteboard items the same way as in Paper. The `DataTransferItem` resulting from the pasteboard conversion of the dragged items is used to build the JS payload for the dragEnter/dragLeave/drop events. Test Plan: * Run Zeratul with Fabric enabled * Drag and drop an image on the messages view * Send the attachment https://pxl.cl/4ldB7 Reviewers: shawndempsey, #rn-desktop Reviewed By: shawndempsey Differential Revision: https://phabricator.intern.facebook.com/D53674742
tido64
reviewed
Oct 2, 2025
packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm
Outdated
Show resolved
Hide resolved
packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm
Outdated
Show resolved
Hide resolved
packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm
Outdated
Show resolved
Hide resolved
packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm
Outdated
Show resolved
Hide resolved
...erer/components/view/platform/macos/react/renderer/components/view/HostPlatformViewProps.cpp
Outdated
Show resolved
Hide resolved
fascinating -- would love to see a video and also a link to relevant docs for the current (core or community) API being supported here! |
I can link the PR where it was implemented for paper.. we have a demo in RNTester |
Co-authored-by: Tommy Nguyen <[email protected]>
tido64
reviewed
Oct 6, 2025
packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm
Outdated
Show resolved
Hide resolved
packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm
Show resolved
Hide resolved
tido64
approved these changes
Oct 7, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary:
Cherry pick more commits from #2117 to implement Drag and Drop Support on View.
Test Plan:
Moved the TextInput example (which doesn't work on Fabric yet) to a new page, and added a View example (which does work on Fabric)
Screen.Recording.2025-10-03.at.4.39.11.PM.mov