72 lines
3.1 KiB
Diff
72 lines
3.1 KiB
Diff
diff --git a/node_modules/@react-native-clipboard/clipboard/android/src/main/java/com/reactnativecommunity/clipboard/ClipboardModule.java b/node_modules/@react-native-clipboard/clipboard/android/src/main/java/com/reactnativecommunity/clipboard/ClipboardModule.java
|
|
index 048ebe5..8afa5b2 100644
|
|
--- a/node_modules/@react-native-clipboard/clipboard/android/src/main/java/com/reactnativecommunity/clipboard/ClipboardModule.java
|
|
+++ b/node_modules/@react-native-clipboard/clipboard/android/src/main/java/com/reactnativecommunity/clipboard/ClipboardModule.java
|
|
@@ -156,6 +156,17 @@ public class ClipboardModule extends ReactContextBaseJavaModule {
|
|
}
|
|
}
|
|
|
|
+ @ReactMethod
|
|
+ public void setURI(String uri) {
|
|
+ try {
|
|
+ ClipData clipdata = ClipData.newUri(reactContext.getContentResolver(), "URI", Uri.parse(uri));
|
|
+ ClipboardManager clipboard = getClipboardService();
|
|
+ clipboard.setPrimaryClip(clipdata);
|
|
+ } catch (Exception e) {
|
|
+ e.printStackTrace();
|
|
+ }
|
|
+ }
|
|
+
|
|
@ReactMethod
|
|
public void setListener() {
|
|
try {
|
|
diff --git a/node_modules/@react-native-clipboard/clipboard/dist/Clipboard.d.ts b/node_modules/@react-native-clipboard/clipboard/dist/Clipboard.d.ts
|
|
index a3e4abd..904a199 100644
|
|
--- a/node_modules/@react-native-clipboard/clipboard/dist/Clipboard.d.ts
|
|
+++ b/node_modules/@react-native-clipboard/clipboard/dist/Clipboard.d.ts
|
|
@@ -81,6 +81,17 @@ export declare const Clipboard: {
|
|
* @param the content to be stored in the clipboard.
|
|
*/
|
|
setStrings(content: string[]): void;
|
|
+ /**
|
|
+ * (Android Only)
|
|
+ * Set content of URI type. You can use following code to set clipboard content
|
|
+ * ```javascript
|
|
+ * _setContent() {
|
|
+ * Clipboard.setURI('file://com.example.app/files/image.png');
|
|
+ * }
|
|
+ * ```
|
|
+ * @param the content to be stored in the clipboard.
|
|
+ */
|
|
+ setURI(content: string): void;
|
|
/**
|
|
* Returns whether the clipboard has content or is empty.
|
|
* This method returns a `Promise`, so you can use following code to get clipboard content
|
|
diff --git a/node_modules/@react-native-clipboard/clipboard/dist/Clipboard.js b/node_modules/@react-native-clipboard/clipboard/dist/Clipboard.js
|
|
index 67b7237..0a74329 100644
|
|
--- a/node_modules/@react-native-clipboard/clipboard/dist/Clipboard.js
|
|
+++ b/node_modules/@react-native-clipboard/clipboard/dist/Clipboard.js
|
|
@@ -123,6 +123,22 @@ exports.Clipboard = {
|
|
setStrings: function (content) {
|
|
NativeClipboard_1.default.setStrings(content);
|
|
},
|
|
+ /**
|
|
+ * (Android Only)
|
|
+ * Set content of URI type. You can use following code to set clipboard content
|
|
+ * ```javascript
|
|
+ * _setContent() {
|
|
+ * Clipboard.setURI('file://com.example.app/files/image.png');
|
|
+ * }
|
|
+ * ```
|
|
+ * @param the content to be stored in the clipboard.
|
|
+ */
|
|
+ setURI: function (content) {
|
|
+ if (react_native_1.Platform.OS !== 'android') {
|
|
+ return;
|
|
+ }
|
|
+ return NativeClipboard_1.default.setURI(content);
|
|
+ },
|
|
/**
|
|
* Returns whether the clipboard has content or is empty.
|
|
* This method returns a `Promise`, so you can use following code to get clipboard content
|