Skip to content

Commit 1cff511

Browse files
committed
create patch
1 parent 390c63c commit 1cff511

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

patches/react-native+0.79.2+011+Add-onPaste-to-TextInput.patch

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ index 0000000..bfb5819
445445
+ public void onPaste(String type, String data);
446446
+}
447447
diff --git a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java
448-
index 42f2383..35bfa4d 100644
448+
index 42f2383..9a98163 100644
449449
--- a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java
450450
+++ b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java
451451
@@ -9,6 +9,10 @@ package com.facebook.react.views.textinput;
@@ -483,7 +483,7 @@ index 42f2383..35bfa4d 100644
483483
mTextAttributes = new TextAttributes();
484484

485485
applyTextAttributes();
486-
@@ -335,8 +342,38 @@ public class ReactEditText extends AppCompatEditText {
486+
@@ -335,8 +342,40 @@ public class ReactEditText extends AppCompatEditText {
487487
*/
488488
@Override
489489
public boolean onTextContextMenuItem(int id) {
@@ -503,12 +503,14 @@ index 42f2383..35bfa4d 100644
503503
+ if (itemUri != null) {
504504
+ ContentResolver cr = getReactContext(this).getContentResolver();
505505
+ type = cr.getType(itemUri);
506-
+ data = itemUri.toString();
507-
+ if (mPasteWatcher != null) {
508-
+ mPasteWatcher.onPaste(type, data);
506+
+ if (type != null && !type.equals(ClipDescription.MIMETYPE_TEXT_PLAIN)) {
507+
+ data = itemUri.toString();
508+
+ if (mPasteWatcher != null) {
509+
+ mPasteWatcher.onPaste(type, data);
510+
+ }
511+
+ // Prevents default behavior to avoid inserting raw binary data into the text field
512+
+ return true;
509513
+ }
510-
+ // Prevents default behavior to avoid inserting raw binary data into the text field
511-
+ return true;
512514
+ }
513515
+
514516
+ if (clipData.getDescription().hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN)) {
@@ -523,7 +525,7 @@ index 42f2383..35bfa4d 100644
523525
}
524526
return super.onTextContextMenuItem(id);
525527
}
526-
@@ -417,6 +454,10 @@ public class ReactEditText extends AppCompatEditText {
528+
@@ -417,6 +456,10 @@ public class ReactEditText extends AppCompatEditText {
527529
mScrollWatcher = scrollWatcher;
528530
}
529531

0 commit comments

Comments
 (0)