Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions patches/react-native/details.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,17 @@

### [react-native+0.79.2+011+Add-onPaste-to-TextInput.patch](react-native+0.79.2+011+Add-onPaste-to-TextInput.patch)

- Reason: Adds onPaste event handler to TextInput component
- Upstream PR/issue: 🛑
- E/App issue: 🛑
- PR Introducing Patch: 🛑
- Reasons:
- Adds `onPaste` callback to `TextInput` to support image pasting on native
- Fixes an issue where pasted image displays as binary text on some Android devices where rich clipboard data is stored in binary form
- Fixes an issue where pasting from WPS Office app crashes the app on Android where its content URI is not recognized by Android `ContentResolver`
- Upstream PR/issue: https://github.com/facebook/react-native/pull/45425
- Upstream RFC: https://github.com/s77rt/discussions-and-proposals/blob/TextInput-onPaste/proposals/0000-textinput-onpaste.md
- E/App issue:
- https://github.com/Expensify/App/issues/41239
- https://github.com/Expensify/App/issues/55304
- https://github.com/Expensify/App/issues/63191
- PR Introducing Patch: [#47203](https://github.com/Expensify/App/pull/47203)

### [react-native+0.79.2+012+alert-style.patch](react-native+0.79.2+012+alert-style.patch)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ index 0000000..bfb5819
+ public void onPaste(String type, String data);
+}
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
index 42f2383..35bfa4d 100644
index 42f2383..9a98163 100644
--- 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
@@ -9,6 +9,10 @@ package com.facebook.react.views.textinput;
Expand Down Expand Up @@ -483,7 +483,7 @@ index 42f2383..35bfa4d 100644
mTextAttributes = new TextAttributes();

applyTextAttributes();
@@ -335,8 +342,38 @@ public class ReactEditText extends AppCompatEditText {
@@ -335,8 +342,40 @@ public class ReactEditText extends AppCompatEditText {
*/
@Override
public boolean onTextContextMenuItem(int id) {
Expand All @@ -503,12 +503,14 @@ index 42f2383..35bfa4d 100644
+ if (itemUri != null) {
+ ContentResolver cr = getReactContext(this).getContentResolver();
+ type = cr.getType(itemUri);
+ data = itemUri.toString();
+ if (mPasteWatcher != null) {
+ mPasteWatcher.onPaste(type, data);
+ if (type != null && !type.equals(ClipDescription.MIMETYPE_TEXT_PLAIN)) {
+ data = itemUri.toString();
+ if (mPasteWatcher != null) {
+ mPasteWatcher.onPaste(type, data);
+ }
+ // Prevents default behavior to avoid inserting raw binary data into the text field
+ return true;
+ }
+ // Prevents default behavior to avoid inserting raw binary data into the text field
+ return true;
+ }
+
+ if (clipData.getDescription().hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN)) {
Expand All @@ -523,7 +525,7 @@ index 42f2383..35bfa4d 100644
}
return super.onTextContextMenuItem(id);
}
@@ -417,6 +454,10 @@ public class ReactEditText extends AppCompatEditText {
@@ -417,6 +456,10 @@ public class ReactEditText extends AppCompatEditText {
mScrollWatcher = scrollWatcher;
}

Expand Down