forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 149
feat(fabric): Implement Paste for TextInput #2715
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
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
2476f7a to
35d1f10
Compare
Summary: This diff refactors the data transfer item payload conversion logic to share it with `TextInputEventEmitter` paste event, allowing to implement the onPaste event emitters building the same payload as generated by the drag and drop implementation. Test Plan: Tested later in this stack. Reviewers: shawndempsey, #rn-desktop Reviewed By: shawndempsey Differential Revision: https://phabricator.intern.facebook.com/D53694921
Summary: Implement the file/image pasteboard pasting event for the `TextInput` component in Fabric. The payload for the event is the same as for the drag and drop events. Test Plan: * Run Zeratul with Fabric enabled * Copy an image/file on the pasteboard * Focus the message composer * Paste the image/file and send the message https://pxl.cl/4lk92 Reviewers: shawndempsey, #rn-desktop Reviewed By: shawndempsey Differential Revision: https://phabricator.intern.facebook.com/D53694922
Summary: **Context** - Configuring paste options was never implemented in our Fabric TextInput - Paper Implementation: https://www.internalfb.com/code/fbsource/[93ff90a797da]/third-party/microsoft-fork-of-react-native/react-native-macos/packages/react-native/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m?lines=29-35 https://www.internalfb.com/code/fbsource/[563690cf01f1]/third-party/microsoft-fork-of-react-native/react-native-macos/packages/react-native/React/Base/RCTConvert.m?lines=1239 **Change** - Add c++ enum/prop - Add conversion - Add `pastedTypes` to Fabric component Test Plan: |Fabric|Paper| | https://pxl.cl/4LcPw | https://pxl.cl/4LcQL| Reviewers: lefever, #rn-desktop Differential Revision: https://phabricator.intern.facebook.com/D56558929 Tasks: T186086013
9589419 to
ccdb59c
Compare
tido64
approved these changes
Oct 9, 2025
packages/react-native/Libraries/Text/TextInput/Singleline/RCTUITextField.h
Show resolved
Hide resolved
packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm
Outdated
Show resolved
Hide resolved
…w/RCTViewComponentView.mm Co-authored-by: Tommy Nguyen <[email protected]>
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:
Implement onPaste for TextInput. This is fairly heavy as it involves heavily refactoring the
DataTransferobject that is created and sent to JS:Notable changes:
dataTransferPayloadmethod onHostPlatformViewEventEmitter. This means we now have a public method that returns aJSI::Value, which feels a bit odd.pastedTypesprop that matches paper to Fabric TextInputTest Plan:
Existing example in Drag and drop test page still works, and returns the same object payload as paper.