Add prop to filter drag and drop pasting on iOS#50533
Closed
Abbondanzo wants to merge 2 commits intofacebook:mainfrom
Closed
Add prop to filter drag and drop pasting on iOS#50533Abbondanzo wants to merge 2 commits intofacebook:mainfrom
Abbondanzo wants to merge 2 commits intofacebook:mainfrom
Conversation
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D70992749 |
214ec45 to
8a20e68
Compare
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D70992749 |
Summary: On Android, by default, every EditText accepts `DragEvent` and will automatically focus themselves to accept these data. In some rare cases, it might not be desirable to allow data from arbitrary drag and drop events to be pasted into a text input. This change adds a new prop `acceptDragAndDropTypes` to do exactly that: reject drag and drop events by telling the system to ignore certain types of drag data and, by proxy, disabling behavior that automatically focuses the text input. The prop accepts a subset of MIME types supported by Android as documented [here](https://developer.android.com/reference/android/content/ClipDescription#MIMETYPE_TEXT_HTML). It's important to note that this is an experimental prop, as is evident by the `experimental_` prefix on the JS side. Its signature could change before the prop has fully matured, use at your own risk Changelog: [Android][Added] - Add new prop for filtering drag and drop targeting to text inputs Reviewed By: javache Differential Revision: D69674225
Summary: Builds upon facebook#49446 On iOS, by default, every EditText accepts DragEvent and will automatically focus themselves to accept these data. In some rare cases, it might not be desirable to allow data from arbitrary drag and drop events to be pasted into a text input. This change adds a new prop `acceptDragAndDropTypes` to do exactly that: reject drag and drop events by telling the system to ignore certain types of drag data and, by proxy, disabling behavior that automatically focuses the text input. The prop accepts a list of [Uniform Type Identifiers](https://developer.apple.com/documentation/uniformtypeidentifiers) that iOS supports. It's important to note that these are *not* MIME types. A MIME type would be something like `text/plain` but the equivalent for iOS is `public.plain-text`. It's important to note that this is an experimental prop, as is evident by the `experimental_` prefix on the JS side. Its signature could change before the prop has fully matured, use at your own risk Changelog: [iOS][Added] - Add new prop for filtering drag and drop targeting to text inputs Reviewed By: javache Differential Revision: D70992749
8a20e68 to
54fc83d
Compare
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D70992749 |
Contributor
|
This pull request has been merged in 93f12eb. |
Contributor
|
@Abbondanzo Hello! I just ntoiced this PR while doing the React Native macOS upgrade to 0.81. We have a similar prop for macOS on View / TextInput (see microsoft#2713 for the recent Fabric implementation). Happy to see more ppl doing Drag and Drop and I'll see if I can align our props to the new experimental ones :) |
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
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:
Builds upon #49446
On iOS, by default, every EditText accepts DragEvent and will automatically focus themselves to accept these data. In some rare cases, it might not be desirable to allow data from arbitrary drag and drop events to be pasted into a text input.
This change adds a new prop
acceptDragAndDropTypesto do exactly that: reject drag and drop events by telling the system to ignore certain types of drag data and, by proxy, disabling behavior that automatically focuses the text input.The prop accepts a list of Uniform Type Identifiers that iOS supports. It's important to note that these are not MIME types. A MIME type would be something like
text/plainbut the equivalent for iOS ispublic.plain-text.It's important to note that this is an experimental prop, as is evident by the
experimental_prefix on the JS side. Its signature could change before the prop has fully matured, use at your own riskChangelog: [iOS][Added] - Add new prop for filtering drag and drop targeting to text inputs
Differential Revision: D70992749