Skip to content

Conversation

@Abbondanzo
Copy link
Contributor

@Abbondanzo Abbondanzo commented Feb 14, 2025

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.

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

Differential Revision: D69674225

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 14, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69674225

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69674225

Abbondanzo added a commit to Abbondanzo/react-native that referenced this pull request Apr 7, 2025
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

Differential Revision: D69674225
Abbondanzo added a commit to Abbondanzo/react-native that referenced this pull request Apr 7, 2025
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

Differential Revision: D69674225
Abbondanzo added a commit to Abbondanzo/react-native that referenced this pull request Apr 7, 2025
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

Differential Revision: D70992749
@Abbondanzo Abbondanzo changed the title Add prop to disable drag and drop pasting on Android Add prop to filter drag and drop pasting on Android Apr 7, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69674225

Abbondanzo added a commit to Abbondanzo/react-native that referenced this pull request Apr 21, 2025
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

Differential Revision: D69674225
Abbondanzo added a commit to Abbondanzo/react-native that referenced this pull request Apr 21, 2025
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

Differential Revision: D69674225
Abbondanzo added a commit to Abbondanzo/react-native that referenced this pull request Apr 21, 2025
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

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
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69674225

Abbondanzo added a commit to Abbondanzo/react-native that referenced this pull request Apr 23, 2025
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
Abbondanzo added a commit to Abbondanzo/react-native that referenced this pull request Apr 23, 2025
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
facebook-github-bot pushed a commit that referenced this pull request Apr 23, 2025
Summary:
Pull Request resolved: #50533

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 `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

fbshipit-source-id: 22b5aa1b4ced14147bf16a844361acf6f99c5a40
@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Apr 23, 2025
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in d10dd71.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @Abbondanzo in d10dd71

When will my fix make it into a release? | How to file a pick request?

@Abbondanzo Abbondanzo deleted the export-D69674225 branch April 23, 2025 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants