expo-clipboard 56.0.3 → 56.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/android/build.gradle +2 -2
- package/build/Clipboard.d.ts +4 -1
- package/build/Clipboard.d.ts.map +1 -1
- package/build/Clipboard.js +4 -1
- package/build/Clipboard.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/ClipboardModule.swift +8 -1
- package/ios/ClipboardPasteButton.swift +2 -0
- package/ios/ClipboardPasteButtonRecords.swift +2 -0
- package/ios/ExpoClipboard.podspec +2 -1
- package/ios/NSAttributedString+utilities.swift +2 -0
- package/ios/NSPasteboard+Clipboard.swift +117 -0
- package/ios/UIPasteboard+html.swift +2 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/{56.0.3/expo.modules.clipboard-56.0.3.module → 56.0.4/expo.modules.clipboard-56.0.4.module} +7 -7
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/56.0.4/expo.modules.clipboard-56.0.4.module.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/56.0.4/expo.modules.clipboard-56.0.4.module.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/56.0.4/expo.modules.clipboard-56.0.4.module.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/56.0.4/expo.modules.clipboard-56.0.4.module.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/{56.0.3/expo.modules.clipboard-56.0.3.pom → 56.0.4/expo.modules.clipboard-56.0.4.pom} +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/56.0.4/expo.modules.clipboard-56.0.4.pom.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/56.0.4/expo.modules.clipboard-56.0.4.pom.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/56.0.4/expo.modules.clipboard-56.0.4.pom.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/56.0.4/expo.modules.clipboard-56.0.4.pom.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/maven-metadata.xml +4 -4
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/maven-metadata.xml.sha512 +1 -1
- package/package.json +5 -5
- package/src/Clipboard.ts +4 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/56.0.3/expo.modules.clipboard-56.0.3.module.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/56.0.3/expo.modules.clipboard-56.0.3.module.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/56.0.3/expo.modules.clipboard-56.0.3.module.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/56.0.3/expo.modules.clipboard-56.0.3.module.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/56.0.3/expo.modules.clipboard-56.0.3.pom.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/56.0.3/expo.modules.clipboard-56.0.3.pom.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/56.0.3/expo.modules.clipboard-56.0.3.pom.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/56.0.3/expo.modules.clipboard-56.0.3.pom.sha512 +0 -1
- /package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/{56.0.3/expo.modules.clipboard-56.0.3-sources.jar → 56.0.4/expo.modules.clipboard-56.0.4-sources.jar} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/{56.0.3/expo.modules.clipboard-56.0.3-sources.jar.md5 → 56.0.4/expo.modules.clipboard-56.0.4-sources.jar.md5} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/{56.0.3/expo.modules.clipboard-56.0.3-sources.jar.sha1 → 56.0.4/expo.modules.clipboard-56.0.4-sources.jar.sha1} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/{56.0.3/expo.modules.clipboard-56.0.3-sources.jar.sha256 → 56.0.4/expo.modules.clipboard-56.0.4-sources.jar.sha256} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/{56.0.3/expo.modules.clipboard-56.0.3-sources.jar.sha512 → 56.0.4/expo.modules.clipboard-56.0.4-sources.jar.sha512} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/{56.0.3/expo.modules.clipboard-56.0.3.aar → 56.0.4/expo.modules.clipboard-56.0.4.aar} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/{56.0.3/expo.modules.clipboard-56.0.3.aar.md5 → 56.0.4/expo.modules.clipboard-56.0.4.aar.md5} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/{56.0.3/expo.modules.clipboard-56.0.3.aar.sha1 → 56.0.4/expo.modules.clipboard-56.0.4.aar.sha1} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/{56.0.3/expo.modules.clipboard-56.0.3.aar.sha256 → 56.0.4/expo.modules.clipboard-56.0.4.aar.sha256} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.clipboard/{56.0.3/expo.modules.clipboard-56.0.3.aar.sha512 → 56.0.4/expo.modules.clipboard-56.0.4.aar.sha512} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 56.0.4 — 2026-06-05
|
|
14
|
+
|
|
15
|
+
### 🎉 New features
|
|
16
|
+
|
|
17
|
+
- Add macOS support. ([#46479](https://github.com/expo/expo/pull/46479) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
|
18
|
+
|
|
13
19
|
## 56.0.3 — 2026-05-06
|
|
14
20
|
|
|
15
21
|
_This version does not introduce any user-facing changes._
|
package/android/build.gradle
CHANGED
package/build/Clipboard.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export declare function hasStringAsync(): Promise<boolean>;
|
|
|
37
37
|
*
|
|
38
38
|
* @returns A promise that fulfills to the URL in the clipboard, or null if no URL is present or permission was denied.
|
|
39
39
|
* @platform ios
|
|
40
|
+
* @platform macos
|
|
40
41
|
*/
|
|
41
42
|
export declare function getUrlAsync(): Promise<string | null>;
|
|
42
43
|
/**
|
|
@@ -48,6 +49,7 @@ export declare function getUrlAsync(): Promise<string | null>;
|
|
|
48
49
|
*
|
|
49
50
|
* @param url The URL to save to the clipboard.
|
|
50
51
|
* @platform ios
|
|
52
|
+
* @platform macos
|
|
51
53
|
*/
|
|
52
54
|
export declare function setUrlAsync(url: string): Promise<void>;
|
|
53
55
|
/**
|
|
@@ -55,6 +57,7 @@ export declare function setUrlAsync(url: string): Promise<void>;
|
|
|
55
57
|
*
|
|
56
58
|
* @returns A promise that fulfills to `true` if clipboard has URL content, resolves to `false` otherwise.
|
|
57
59
|
* @platform ios
|
|
60
|
+
* @platform macos
|
|
58
61
|
*/
|
|
59
62
|
export declare function hasUrlAsync(): Promise<boolean>;
|
|
60
63
|
/**
|
|
@@ -103,7 +106,7 @@ export declare function setImageAsync(base64Image: string): Promise<void>;
|
|
|
103
106
|
export declare function hasImageAsync(): Promise<boolean>;
|
|
104
107
|
/**
|
|
105
108
|
* Adds a listener that will fire whenever the content of the user's clipboard changes. This method
|
|
106
|
-
* is a no-op on Web.
|
|
109
|
+
* is a no-op on Web and macOS.
|
|
107
110
|
*
|
|
108
111
|
* @param listener Callback to execute when listener is triggered. The callback is provided a
|
|
109
112
|
* single argument that is an object containing information about clipboard contents.
|
package/build/Clipboard.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Clipboard.d.ts","sourceRoot":"","sources":["../src/Clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAiC,MAAM,mBAAmB,CAAC;AAE1F,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAI3B,YAAY,EAAE,iBAAiB,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE3E;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAAC,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,CAKpF;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,OAAO,CAAC,CAKlB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC,CAKjD;AAED
|
|
1
|
+
{"version":3,"file":"Clipboard.d.ts","sourceRoot":"","sources":["../src/Clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAiC,MAAM,mBAAmB,CAAC;AAE1F,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAI3B,YAAY,EAAE,iBAAiB,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE3E;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAAC,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,CAKpF;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,OAAO,CAAC,CAKlB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC,CAKjD;AAED;;;;;;;;;GASG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAK1D;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAK5D;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAKpD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAK5F;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKtE;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAKtD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,GAAG,iBAAiB,CAEjG;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,iBAAiB,QAEtE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,OACiC,CAAC;AAEvE,cAAc,mBAAmB,CAAC;AAElC,OAAO,EAAE,oBAAoB,EAAE,KAAK,yBAAyB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/build/Clipboard.js
CHANGED
|
@@ -51,6 +51,7 @@ export function hasStringAsync() {
|
|
|
51
51
|
*
|
|
52
52
|
* @returns A promise that fulfills to the URL in the clipboard, or null if no URL is present or permission was denied.
|
|
53
53
|
* @platform ios
|
|
54
|
+
* @platform macos
|
|
54
55
|
*/
|
|
55
56
|
export async function getUrlAsync() {
|
|
56
57
|
if (!ExpoClipboard.getUrlAsync) {
|
|
@@ -67,6 +68,7 @@ export async function getUrlAsync() {
|
|
|
67
68
|
*
|
|
68
69
|
* @param url The URL to save to the clipboard.
|
|
69
70
|
* @platform ios
|
|
71
|
+
* @platform macos
|
|
70
72
|
*/
|
|
71
73
|
export async function setUrlAsync(url) {
|
|
72
74
|
if (!ExpoClipboard.setUrlAsync) {
|
|
@@ -79,6 +81,7 @@ export async function setUrlAsync(url) {
|
|
|
79
81
|
*
|
|
80
82
|
* @returns A promise that fulfills to `true` if clipboard has URL content, resolves to `false` otherwise.
|
|
81
83
|
* @platform ios
|
|
84
|
+
* @platform macos
|
|
82
85
|
*/
|
|
83
86
|
export async function hasUrlAsync() {
|
|
84
87
|
if (!ExpoClipboard.hasUrlAsync) {
|
|
@@ -147,7 +150,7 @@ export async function hasImageAsync() {
|
|
|
147
150
|
}
|
|
148
151
|
/**
|
|
149
152
|
* Adds a listener that will fire whenever the content of the user's clipboard changes. This method
|
|
150
|
-
* is a no-op on Web.
|
|
153
|
+
* is a no-op on Web and macOS.
|
|
151
154
|
*
|
|
152
155
|
* @param listener Callback to execute when listener is triggered. The callback is provided a
|
|
153
156
|
* single argument that is an object containing information about clipboard contents.
|
package/build/Clipboard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Clipboard.js","sourceRoot":"","sources":["../src/Clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,mBAAmB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAS1F,OAAO,aAAa,EAAE,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAKpE;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,UAA4B,EAAE;IACjE,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;QAClC,MAAM,IAAI,mBAAmB,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,MAAM,aAA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K,CAAC;AAEvE,cAAc,mBAAmB,CAAC;AAElC,OAAO,EAAE,oBAAoB,EAAkC,MAAM,wBAAwB,CAAC","sourcesContent":["import { type EventSubscription, UnavailabilityError, Platform } from 'expo-modules-core';\n\nimport type {\n ClipboardImage,\n ClipboardEvent,\n GetImageOptions,\n GetStringOptions,\n SetStringOptions,\n} from './Clipboard.types';\nimport ExpoClipboard, { clipboardEventName } from './ExpoClipboard';\n\n// TODO(@kitten): Remove re-export from EMC\nexport type { EventSubscription as Subscription } from 'expo-modules-core';\n\n/**\n * Gets the content of the user's clipboard. Calling this method on web will prompt\n * the user to grant your app permission to \"see text and images copied to the clipboard.\"\n *\n * Note: On iOS 16+, if the user denies paste permission, this method will return an empty string.\n * Due to iOS platform limitations, there is no way to distinguish between an empty clipboard and denied permission.\n *\n * @param options Options for the clipboard content to be retrieved.\n * @returns A promise that resolves to the content of the clipboard, or an empty string if clipboard is empty or permission was denied.\n */\nexport async function getStringAsync(options: GetStringOptions = {}): Promise<string> {\n if (!ExpoClipboard.getStringAsync) {\n throw new UnavailabilityError('Clipboard', 'getStringAsync');\n }\n return await ExpoClipboard.getStringAsync(options);\n}\n\n/**\n * Sets the content of the user's clipboard.\n *\n * @param text The string to save to the clipboard.\n * @param options Options for the clipboard content to be set.\n * @returns On web, this returns a promise that fulfills to a boolean value indicating whether or not\n * the string was saved to the user's clipboard. On iOS and Android, the promise always resolves to `true`.\n */\nexport async function setStringAsync(\n text: string,\n options: SetStringOptions = {}\n): Promise<boolean> {\n if (!ExpoClipboard.setStringAsync) {\n throw new UnavailabilityError('Clipboard', 'setStringAsync');\n }\n return ExpoClipboard.setStringAsync(text, options);\n}\n\n/**\n * Returns whether the clipboard has text content. Returns true for both plain text and rich text (e.g. HTML).\n *\n * On web, this requires the user to grant your app permission to _\"see text and images copied to the clipboard\"_.\n *\n * @returns A promise that fulfills to `true` if clipboard has text content, resolves to `false` otherwise.\n */\nexport function hasStringAsync(): Promise<boolean> {\n if (!ExpoClipboard.hasStringAsync) {\n throw new UnavailabilityError('Clipboard', 'hasStringAsync');\n }\n return ExpoClipboard.hasStringAsync();\n}\n\n/**\n * Gets the URL from the user's clipboard.\n *\n * Note: On iOS 16+, if the user denies paste permission, this method will return null.\n * Due to iOS platform limitations, there is no way to distinguish between no URL in clipboard and denied permission.\n *\n * @returns A promise that fulfills to the URL in the clipboard, or null if no URL is present or permission was denied.\n * @platform ios\n */\nexport async function getUrlAsync(): Promise<string | null> {\n if (!ExpoClipboard.getUrlAsync) {\n throw new UnavailabilityError('Clipboard', 'getUrlAsync');\n }\n return await ExpoClipboard.getUrlAsync();\n}\n\n/**\n * Sets a URL in the user's clipboard.\n *\n * This function behaves the same as [`setStringAsync()`](#setstringasynctext-options), except that\n * it sets the clipboard content type to be a URL. It lets your app or other apps know that the\n * clipboard contains a URL and behave accordingly.\n *\n * @param url The URL to save to the clipboard.\n * @platform ios\n */\nexport async function setUrlAsync(url: string): Promise<void> {\n if (!ExpoClipboard.setUrlAsync) {\n throw new UnavailabilityError('Clipboard', 'setUrlAsync');\n }\n return ExpoClipboard.setUrlAsync(url);\n}\n\n/**\n * Returns whether the clipboard has a URL content.\n *\n * @returns A promise that fulfills to `true` if clipboard has URL content, resolves to `false` otherwise.\n * @platform ios\n */\nexport async function hasUrlAsync(): Promise<boolean> {\n if (!ExpoClipboard.hasUrlAsync) {\n throw new UnavailabilityError('Clipboard', 'hasUrlAsync');\n }\n return await ExpoClipboard.hasUrlAsync();\n}\n\n/**\n * Gets the image from the user's clipboard and returns it in the specified\n * format. Calling this method on web will prompt the user to grant your app\n * permission to \"see text and images copied to the clipboard.\"\n *\n * Note: On iOS 16+, if the user denies paste permission, this method will return null.\n * Due to iOS platform limitations, there is no way to distinguish between no image in clipboard and denied permission.\n *\n * @param options A `GetImageOptions` object to specify the desired format of the image.\n * @returns If there was an image in the clipboard, the promise resolves to\n * a [`ClipboardImage`](#clipboardimage) object containing the base64 string and metadata of the image.\n * Otherwise, it resolves to `null` (this includes cases where permission was denied).\n *\n * @example\n * ```tsx\n * const img = await Clipboard.getImageAsync({ format: 'png' });\n * // ...\n * <Image source={{ uri: img?.data }} style={{ width: 200, height: 200 }} />\n * ```\n */\nexport async function getImageAsync(options: GetImageOptions): Promise<ClipboardImage | null> {\n if (!ExpoClipboard.getImageAsync) {\n throw new UnavailabilityError('Clipboard', 'getImageAsync');\n }\n return await ExpoClipboard.getImageAsync(options);\n}\n\n/**\n * Sets an image in the user's clipboard.\n *\n * @param base64Image Image encoded as a base64 string, without MIME type.\n *\n * @example\n * ```tsx\n * const result = await ImagePicker.launchImageLibraryAsync({\n * mediaTypes: ImagePicker.MediaTypeOptions.Images,\n * base64: true,\n * });\n * await Clipboard.setImageAsync(result.base64);\n * ```\n */\nexport async function setImageAsync(base64Image: string): Promise<void> {\n if (!ExpoClipboard.setImageAsync) {\n throw new UnavailabilityError('Clipboard', 'setImageAsync');\n }\n return ExpoClipboard.setImageAsync(base64Image);\n}\n\n/**\n * Returns whether the clipboard has an image content.\n *\n * On web, this requires the user to grant your app permission to _\"see text and images copied to the clipboard\"_.\n *\n * @returns A promise that fulfills to `true` if clipboard has image content, resolves to `false` otherwise.\n */\nexport async function hasImageAsync(): Promise<boolean> {\n if (!ExpoClipboard.hasImageAsync) {\n throw new UnavailabilityError('Clipboard', 'hasImageAsync');\n }\n return ExpoClipboard.hasImageAsync();\n}\n\n/**\n * Adds a listener that will fire whenever the content of the user's clipboard changes. This method\n * is a no-op on Web.\n *\n * @param listener Callback to execute when listener is triggered. The callback is provided a\n * single argument that is an object containing information about clipboard contents.\n *\n * @example\n * ```typescript\n * Clipboard.addClipboardListener(({ contentTypes }: ClipboardEvent) => {\n * if (contentTypes.includes(Clipboard.ContentType.PLAIN_TEXT)) {\n * Clipboard.getStringAsync().then(content => {\n * alert('Copy pasta! Here\\'s the string that was copied: ' + content)\n * });\n * } else if (contentTypes.includes(Clipboard.ContentType.IMAGE)) {\n * alert('Yay! Clipboard contains an image');\n * }\n * });\n * ```\n */\nexport function addClipboardListener(listener: (event: ClipboardEvent) => void): EventSubscription {\n return ExpoClipboard.addListener(clipboardEventName, listener);\n}\n\n/**\n * Removes the listener added by addClipboardListener. This method is a no-op on Web.\n * @deprecated use subscription.remove() instead.\n */\nexport function removeClipboardListener(subscription: EventSubscription) {\n subscription.remove();\n}\n\n/**\n * Property that determines if the `ClipboardPasteButton` is available.\n *\n * This requires the users device to be using at least iOS 16.\n *\n * `true` if the component is available, and `false` otherwise.\n */\nexport const isPasteButtonAvailable: boolean =\n Platform.OS === 'ios' ? ExpoClipboard.isPasteButtonAvailable : false;\n\nexport * from './Clipboard.types';\n\nexport { ClipboardPasteButton, type ClipboardPasteButtonProps } from './ClipboardPasteButton';\n"]}
|
|
1
|
+
{"version":3,"file":"Clipboard.js","sourceRoot":"","sources":["../src/Clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,mBAAmB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAS1F,OAAO,aAAa,EAAE,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAKpE;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,UAA4B,EAAE;IACjE,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;QAClC,MAAM,IAAI,mBAAmB,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,MAAM,aAAa,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AACrD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAAY,EACZ,UAA4B,EAAE;IAE9B,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;QAClC,MAAM,IAAI,mBAAmB,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,aAAa,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACrD,CAAC;AAED;;;;;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;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,WAAmB;IACrD,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;QACjC,MAAM,IAAI,mBAAmB,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,aAAa,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;AAClD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;QACjC,MAAM,IAAI,mBAAmB,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,aAAa,CAAC,aAAa,EAAE,CAAC;AACvC,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAyC;IAC5E,OAAO,aAAa,CAAC,WAAW,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;AACjE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,YAA+B;IACrE,YAAY,CAAC,MAAM,EAAE,CAAC;AACxB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GACjC,QAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,sBAAsB,CAAC,CAAC,CAAC,KAAK,CAAC;AAEvE,cAAc,mBAAmB,CAAC;AAElC,OAAO,EAAE,oBAAoB,EAAkC,MAAM,wBAAwB,CAAC","sourcesContent":["import { type EventSubscription, UnavailabilityError, Platform } from 'expo-modules-core';\n\nimport type {\n ClipboardImage,\n ClipboardEvent,\n GetImageOptions,\n GetStringOptions,\n SetStringOptions,\n} from './Clipboard.types';\nimport ExpoClipboard, { clipboardEventName } from './ExpoClipboard';\n\n// TODO(@kitten): Remove re-export from EMC\nexport type { EventSubscription as Subscription } from 'expo-modules-core';\n\n/**\n * Gets the content of the user's clipboard. Calling this method on web will prompt\n * the user to grant your app permission to \"see text and images copied to the clipboard.\"\n *\n * Note: On iOS 16+, if the user denies paste permission, this method will return an empty string.\n * Due to iOS platform limitations, there is no way to distinguish between an empty clipboard and denied permission.\n *\n * @param options Options for the clipboard content to be retrieved.\n * @returns A promise that resolves to the content of the clipboard, or an empty string if clipboard is empty or permission was denied.\n */\nexport async function getStringAsync(options: GetStringOptions = {}): Promise<string> {\n if (!ExpoClipboard.getStringAsync) {\n throw new UnavailabilityError('Clipboard', 'getStringAsync');\n }\n return await ExpoClipboard.getStringAsync(options);\n}\n\n/**\n * Sets the content of the user's clipboard.\n *\n * @param text The string to save to the clipboard.\n * @param options Options for the clipboard content to be set.\n * @returns On web, this returns a promise that fulfills to a boolean value indicating whether or not\n * the string was saved to the user's clipboard. On iOS and Android, the promise always resolves to `true`.\n */\nexport async function setStringAsync(\n text: string,\n options: SetStringOptions = {}\n): Promise<boolean> {\n if (!ExpoClipboard.setStringAsync) {\n throw new UnavailabilityError('Clipboard', 'setStringAsync');\n }\n return ExpoClipboard.setStringAsync(text, options);\n}\n\n/**\n * Returns whether the clipboard has text content. Returns true for both plain text and rich text (e.g. HTML).\n *\n * On web, this requires the user to grant your app permission to _\"see text and images copied to the clipboard\"_.\n *\n * @returns A promise that fulfills to `true` if clipboard has text content, resolves to `false` otherwise.\n */\nexport function hasStringAsync(): Promise<boolean> {\n if (!ExpoClipboard.hasStringAsync) {\n throw new UnavailabilityError('Clipboard', 'hasStringAsync');\n }\n return ExpoClipboard.hasStringAsync();\n}\n\n/**\n * Gets the URL from the user's clipboard.\n *\n * Note: On iOS 16+, if the user denies paste permission, this method will return null.\n * Due to iOS platform limitations, there is no way to distinguish between no URL in clipboard and denied permission.\n *\n * @returns A promise that fulfills to the URL in the clipboard, or null if no URL is present or permission was denied.\n * @platform ios\n * @platform macos\n */\nexport async function getUrlAsync(): Promise<string | null> {\n if (!ExpoClipboard.getUrlAsync) {\n throw new UnavailabilityError('Clipboard', 'getUrlAsync');\n }\n return await ExpoClipboard.getUrlAsync();\n}\n\n/**\n * Sets a URL in the user's clipboard.\n *\n * This function behaves the same as [`setStringAsync()`](#setstringasynctext-options), except that\n * it sets the clipboard content type to be a URL. It lets your app or other apps know that the\n * clipboard contains a URL and behave accordingly.\n *\n * @param url The URL to save to the clipboard.\n * @platform ios\n * @platform macos\n */\nexport async function setUrlAsync(url: string): Promise<void> {\n if (!ExpoClipboard.setUrlAsync) {\n throw new UnavailabilityError('Clipboard', 'setUrlAsync');\n }\n return ExpoClipboard.setUrlAsync(url);\n}\n\n/**\n * Returns whether the clipboard has a URL content.\n *\n * @returns A promise that fulfills to `true` if clipboard has URL content, resolves to `false` otherwise.\n * @platform ios\n * @platform macos\n */\nexport async function hasUrlAsync(): Promise<boolean> {\n if (!ExpoClipboard.hasUrlAsync) {\n throw new UnavailabilityError('Clipboard', 'hasUrlAsync');\n }\n return await ExpoClipboard.hasUrlAsync();\n}\n\n/**\n * Gets the image from the user's clipboard and returns it in the specified\n * format. Calling this method on web will prompt the user to grant your app\n * permission to \"see text and images copied to the clipboard.\"\n *\n * Note: On iOS 16+, if the user denies paste permission, this method will return null.\n * Due to iOS platform limitations, there is no way to distinguish between no image in clipboard and denied permission.\n *\n * @param options A `GetImageOptions` object to specify the desired format of the image.\n * @returns If there was an image in the clipboard, the promise resolves to\n * a [`ClipboardImage`](#clipboardimage) object containing the base64 string and metadata of the image.\n * Otherwise, it resolves to `null` (this includes cases where permission was denied).\n *\n * @example\n * ```tsx\n * const img = await Clipboard.getImageAsync({ format: 'png' });\n * // ...\n * <Image source={{ uri: img?.data }} style={{ width: 200, height: 200 }} />\n * ```\n */\nexport async function getImageAsync(options: GetImageOptions): Promise<ClipboardImage | null> {\n if (!ExpoClipboard.getImageAsync) {\n throw new UnavailabilityError('Clipboard', 'getImageAsync');\n }\n return await ExpoClipboard.getImageAsync(options);\n}\n\n/**\n * Sets an image in the user's clipboard.\n *\n * @param base64Image Image encoded as a base64 string, without MIME type.\n *\n * @example\n * ```tsx\n * const result = await ImagePicker.launchImageLibraryAsync({\n * mediaTypes: ImagePicker.MediaTypeOptions.Images,\n * base64: true,\n * });\n * await Clipboard.setImageAsync(result.base64);\n * ```\n */\nexport async function setImageAsync(base64Image: string): Promise<void> {\n if (!ExpoClipboard.setImageAsync) {\n throw new UnavailabilityError('Clipboard', 'setImageAsync');\n }\n return ExpoClipboard.setImageAsync(base64Image);\n}\n\n/**\n * Returns whether the clipboard has an image content.\n *\n * On web, this requires the user to grant your app permission to _\"see text and images copied to the clipboard\"_.\n *\n * @returns A promise that fulfills to `true` if clipboard has image content, resolves to `false` otherwise.\n */\nexport async function hasImageAsync(): Promise<boolean> {\n if (!ExpoClipboard.hasImageAsync) {\n throw new UnavailabilityError('Clipboard', 'hasImageAsync');\n }\n return ExpoClipboard.hasImageAsync();\n}\n\n/**\n * Adds a listener that will fire whenever the content of the user's clipboard changes. This method\n * is a no-op on Web and macOS.\n *\n * @param listener Callback to execute when listener is triggered. The callback is provided a\n * single argument that is an object containing information about clipboard contents.\n *\n * @example\n * ```typescript\n * Clipboard.addClipboardListener(({ contentTypes }: ClipboardEvent) => {\n * if (contentTypes.includes(Clipboard.ContentType.PLAIN_TEXT)) {\n * Clipboard.getStringAsync().then(content => {\n * alert('Copy pasta! Here\\'s the string that was copied: ' + content)\n * });\n * } else if (contentTypes.includes(Clipboard.ContentType.IMAGE)) {\n * alert('Yay! Clipboard contains an image');\n * }\n * });\n * ```\n */\nexport function addClipboardListener(listener: (event: ClipboardEvent) => void): EventSubscription {\n return ExpoClipboard.addListener(clipboardEventName, listener);\n}\n\n/**\n * Removes the listener added by addClipboardListener. This method is a no-op on Web.\n * @deprecated use subscription.remove() instead.\n */\nexport function removeClipboardListener(subscription: EventSubscription) {\n subscription.remove();\n}\n\n/**\n * Property that determines if the `ClipboardPasteButton` is available.\n *\n * This requires the users device to be using at least iOS 16.\n *\n * `true` if the component is available, and `false` otherwise.\n */\nexport const isPasteButtonAvailable: boolean =\n Platform.OS === 'ios' ? ExpoClipboard.isPasteButtonAvailable : false;\n\nexport * from './Clipboard.types';\n\nexport { ClipboardPasteButton, type ClipboardPasteButtonProps } from './ClipboardPasteButton';\n"]}
|
package/expo-module.config.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
2
|
|
|
3
3
|
import ExpoModulesCore
|
|
4
|
-
import UIKit
|
|
5
4
|
|
|
6
5
|
let onClipboardChanged = "onClipboardChanged"
|
|
7
6
|
|
|
@@ -83,9 +82,11 @@ public class ClipboardModule: Module {
|
|
|
83
82
|
}
|
|
84
83
|
|
|
85
84
|
Property("isPasteButtonAvailable") { () -> Bool in
|
|
85
|
+
#if !os(macOS)
|
|
86
86
|
if #available(iOS 16.0, *) {
|
|
87
87
|
return true
|
|
88
88
|
}
|
|
89
|
+
#endif
|
|
89
90
|
return false
|
|
90
91
|
}
|
|
91
92
|
|
|
@@ -93,6 +94,7 @@ public class ClipboardModule: Module {
|
|
|
93
94
|
|
|
94
95
|
Events(onClipboardChanged)
|
|
95
96
|
|
|
97
|
+
#if !os(macOS)
|
|
96
98
|
OnStartObserving {
|
|
97
99
|
NotificationCenter.default.removeObserver(self, name: UIPasteboard.changedNotification, object: nil)
|
|
98
100
|
NotificationCenter.default.addObserver(
|
|
@@ -106,9 +108,11 @@ public class ClipboardModule: Module {
|
|
|
106
108
|
OnStopObserving {
|
|
107
109
|
NotificationCenter.default.removeObserver(self, name: UIPasteboard.changedNotification, object: nil)
|
|
108
110
|
}
|
|
111
|
+
#endif
|
|
109
112
|
|
|
110
113
|
// MARK: - View
|
|
111
114
|
|
|
115
|
+
#if !os(macOS)
|
|
112
116
|
View(ClipboardPasteButton.self) {
|
|
113
117
|
Events("onPastePressed")
|
|
114
118
|
|
|
@@ -144,14 +148,17 @@ public class ClipboardModule: Module {
|
|
|
144
148
|
view.update()
|
|
145
149
|
}
|
|
146
150
|
}
|
|
151
|
+
#endif
|
|
147
152
|
}
|
|
148
153
|
|
|
154
|
+
#if !os(macOS)
|
|
149
155
|
@objc
|
|
150
156
|
func clipboardChangedListener() {
|
|
151
157
|
sendEvent(onClipboardChanged, [
|
|
152
158
|
"contentTypes": availableContentTypes()
|
|
153
159
|
])
|
|
154
160
|
}
|
|
161
|
+
#endif
|
|
155
162
|
}
|
|
156
163
|
|
|
157
164
|
private func imageToData(_ image: UIImage, options: GetImageOptions) -> Data? {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import ExpoModulesCore
|
|
2
2
|
|
|
3
|
+
#if !os(macOS)
|
|
3
4
|
enum CornerStyle: String, Enumerable {
|
|
4
5
|
case dynamic
|
|
5
6
|
case fixed
|
|
@@ -44,6 +45,7 @@ enum DisplayMode: String, Enumerable {
|
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
}
|
|
48
|
+
#endif
|
|
47
49
|
|
|
48
50
|
enum AcceptedTypes: String, Enumerable {
|
|
49
51
|
case plainText = "plain-text"
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// Copyright 2026-present 650 Industries. All rights reserved.
|
|
2
|
+
|
|
3
|
+
#if os(macOS)
|
|
4
|
+
import ExpoModulesCore
|
|
5
|
+
|
|
6
|
+
extension UIImage {
|
|
7
|
+
func pngData() -> Data? {
|
|
8
|
+
guard let tiff = self.tiffRepresentation,
|
|
9
|
+
let bitmap = NSBitmapImageRep(data: tiff) else {
|
|
10
|
+
return nil
|
|
11
|
+
}
|
|
12
|
+
return bitmap.representation(using: .png, properties: [:])
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
func jpegData(compressionQuality: Double) -> Data? {
|
|
16
|
+
guard let tiff = self.tiffRepresentation,
|
|
17
|
+
let bitmap = NSBitmapImageRep(data: tiff) else {
|
|
18
|
+
return nil
|
|
19
|
+
}
|
|
20
|
+
return bitmap.representation(
|
|
21
|
+
using: .jpeg,
|
|
22
|
+
properties: [.compressionFactor: NSNumber(value: compressionQuality)]
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
extension UIPasteboard {
|
|
28
|
+
var url: URL? {
|
|
29
|
+
get {
|
|
30
|
+
// swiftlint:disable:next legacy_objc_type
|
|
31
|
+
let urls = self.readObjects(forClasses: [NSURL.self], options: nil) as? [URL]
|
|
32
|
+
return urls?.first
|
|
33
|
+
}
|
|
34
|
+
set {
|
|
35
|
+
self.clearContents()
|
|
36
|
+
guard let url = newValue else {
|
|
37
|
+
return
|
|
38
|
+
}
|
|
39
|
+
// swiftlint:disable:next legacy_objc_type
|
|
40
|
+
self.writeObjects([url as NSURL])
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var html: String? {
|
|
45
|
+
get {
|
|
46
|
+
if let htmlString = self.string(forType: .html) {
|
|
47
|
+
return htmlString
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if let rtfData = self.data(forType: .rtf) {
|
|
51
|
+
let attributedString = try? NSAttributedString(
|
|
52
|
+
data: rtfData,
|
|
53
|
+
options: [.documentType: NSAttributedString.DocumentType.rtf],
|
|
54
|
+
documentAttributes: nil
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
if let htmlString = attributedString?.htmlString {
|
|
58
|
+
return htmlString
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return self.string(forType: .string)
|
|
63
|
+
}
|
|
64
|
+
set {
|
|
65
|
+
self.clearContents()
|
|
66
|
+
guard
|
|
67
|
+
let newString = newValue,
|
|
68
|
+
let attributedString = try? NSAttributedString(htmlString: newString)
|
|
69
|
+
else {
|
|
70
|
+
self.setString("", forType: .string)
|
|
71
|
+
return
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if let rtfData = attributedString.rtfData {
|
|
75
|
+
self.setData(rtfData, forType: .rtf)
|
|
76
|
+
}
|
|
77
|
+
if let htmlString = attributedString.htmlString {
|
|
78
|
+
self.setString(htmlString, forType: .html)
|
|
79
|
+
}
|
|
80
|
+
self.setString(attributedString.string, forType: .string)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
var hasStrings: Bool {
|
|
85
|
+
self.canReadItem(withDataConformingToTypes: [NSPasteboard.PasteboardType.string.rawValue])
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
var hasURLs: Bool {
|
|
89
|
+
self.canReadItem(withDataConformingToTypes: [NSPasteboard.PasteboardType.URL.rawValue])
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
var hasHTML: Bool {
|
|
93
|
+
self.canReadItem(withDataConformingToTypes: [
|
|
94
|
+
NSPasteboard.PasteboardType.html.rawValue,
|
|
95
|
+
NSPasteboard.PasteboardType.rtf.rawValue
|
|
96
|
+
])
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
var hasImages: Bool {
|
|
100
|
+
self.canReadObject(forClasses: [NSImage.self], options: nil)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
var image: NSImage? {
|
|
104
|
+
get {
|
|
105
|
+
let images = self.readObjects(forClasses: [NSImage.self], options: nil) as? [NSImage]
|
|
106
|
+
return images?.first
|
|
107
|
+
}
|
|
108
|
+
set {
|
|
109
|
+
self.clearContents()
|
|
110
|
+
guard let image = newValue else {
|
|
111
|
+
return
|
|
112
|
+
}
|
|
113
|
+
self.writeObjects([image])
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
#endif
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
2
|
|
|
3
|
+
#if !os(macOS)
|
|
3
4
|
import UIKit
|
|
4
5
|
import MobileCoreServices
|
|
5
6
|
import UniformTypeIdentifiers
|
|
@@ -46,3 +47,4 @@ extension UIPasteboard {
|
|
|
46
47
|
contains(pasteboardTypes: [UTType.html.identifier, UTType.rtf.identifier])
|
|
47
48
|
}
|
|
48
49
|
}
|
|
50
|
+
#endif
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"component": {
|
|
4
4
|
"group": "host.exp.exponent",
|
|
5
5
|
"module": "expo.modules.clipboard",
|
|
6
|
-
"version": "56.0.
|
|
6
|
+
"version": "56.0.4",
|
|
7
7
|
"attributes": {
|
|
8
8
|
"org.gradle.status": "release"
|
|
9
9
|
}
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
{
|
|
27
|
-
"name": "expo.modules.clipboard-56.0.
|
|
28
|
-
"url": "expo.modules.clipboard-56.0.
|
|
27
|
+
"name": "expo.modules.clipboard-56.0.4.aar",
|
|
28
|
+
"url": "expo.modules.clipboard-56.0.4.aar",
|
|
29
29
|
"size": 79793,
|
|
30
30
|
"sha512": "d576788c626d64f8da90b5fbe0bd028605b29c127d6c58db70eb74af49a3e475767c39115823666c5aee383baac1fc67a76be93edad1e8e1ed3ca8210b726894",
|
|
31
31
|
"sha256": "267fe2425b2ec7e2c5435da301666535c50c36fec12eb09955d3955e502418d9",
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
],
|
|
89
89
|
"files": [
|
|
90
90
|
{
|
|
91
|
-
"name": "expo.modules.clipboard-56.0.
|
|
92
|
-
"url": "expo.modules.clipboard-56.0.
|
|
91
|
+
"name": "expo.modules.clipboard-56.0.4.aar",
|
|
92
|
+
"url": "expo.modules.clipboard-56.0.4.aar",
|
|
93
93
|
"size": 79793,
|
|
94
94
|
"sha512": "d576788c626d64f8da90b5fbe0bd028605b29c127d6c58db70eb74af49a3e475767c39115823666c5aee383baac1fc67a76be93edad1e8e1ed3ca8210b726894",
|
|
95
95
|
"sha256": "267fe2425b2ec7e2c5435da301666535c50c36fec12eb09955d3955e502418d9",
|
|
@@ -108,8 +108,8 @@
|
|
|
108
108
|
},
|
|
109
109
|
"files": [
|
|
110
110
|
{
|
|
111
|
-
"name": "expo.modules.clipboard-56.0.
|
|
112
|
-
"url": "expo.modules.clipboard-56.0.
|
|
111
|
+
"name": "expo.modules.clipboard-56.0.4-sources.jar",
|
|
112
|
+
"url": "expo.modules.clipboard-56.0.4-sources.jar",
|
|
113
113
|
"size": 11507,
|
|
114
114
|
"sha512": "e85c86d8e6ec4e6fac58329ba9d2509dad613d147aa4231d6e6648c98d601e0cd499ff6c206bd6941dad2da2ff9b60bd59593c65b1b1042a89a92a892ac9b866",
|
|
115
115
|
"sha256": "6d9a570d1b001a0677da9d8af70d0c6e0ae2375ab800d21df130837f4ca6a7cb",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
306dd32b008d32112f03a0103347ae75
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
8f25c3cd11c401d167fd957a2617918397c56d3a
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
9f72d36f3ad9a2c3f636527b533cbe0c58d77bb75379f304b52923d827b20d5b
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f3565a90cf91f3e83af9d4eeafe95223bcdcbf05eaa79a908d52f05bb52cdae967abc57a3169747b17a6e81011160a4a767416e3c3c7c896fdd64395d28b86e8
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<modelVersion>4.0.0</modelVersion>
|
|
10
10
|
<groupId>host.exp.exponent</groupId>
|
|
11
11
|
<artifactId>expo.modules.clipboard</artifactId>
|
|
12
|
-
<version>56.0.
|
|
12
|
+
<version>56.0.4</version>
|
|
13
13
|
<packaging>aar</packaging>
|
|
14
14
|
<name>expo.modules.clipboard</name>
|
|
15
15
|
<url>https://github.com/expo/expo</url>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
6b98ac4fb697f3b844fa6a218d477896
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
d9d8037c2a033b39859d735b7eddfef910493c5f
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
010470d4bfa4619487116b7939d41f84f083fc53226aba9c24fc19fa2b6d4182
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2ca491530a09ec3da154402b19f00417128d86024dcab02adf2cbbb273b0176fe5c5d5ecef49554626880bbad68098d7f93eb4c5e436c6566d64557c8d4a51b3
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<groupId>host.exp.exponent</groupId>
|
|
4
4
|
<artifactId>expo.modules.clipboard</artifactId>
|
|
5
5
|
<versioning>
|
|
6
|
-
<latest>56.0.
|
|
7
|
-
<release>56.0.
|
|
6
|
+
<latest>56.0.4</latest>
|
|
7
|
+
<release>56.0.4</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>56.0.
|
|
9
|
+
<version>56.0.4</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20260605211256</lastUpdated>
|
|
12
12
|
</versioning>
|
|
13
13
|
</metadata>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
49fb7e3b93166db88de8762c1fbf27c1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
fabafde9d586ec7c1716bdae8c1d14162d128218
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
e77ee9c2163351d87b3529cdcf77963b3c044164528f344f89d6a3b90eb66d41
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
79f3ddfd19019b4a905a0c1de9159b640c00db5b98fe11f3757406b106c8e451b3339944fc1af0c1c6c0d59e16bec97722b6789d42ae7cce643b500cfe92930c
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-clipboard",
|
|
3
|
-
"version": "56.0.
|
|
4
|
-
"description": "Provides an interface for getting and setting Clipboard content on Android, iOS and Web.",
|
|
3
|
+
"version": "56.0.4",
|
|
4
|
+
"description": "Provides an interface for getting and setting Clipboard content on Android, iOS, macOS and Web.",
|
|
5
5
|
"main": "build/Clipboard.js",
|
|
6
6
|
"types": "build/Clipboard.d.ts",
|
|
7
7
|
"keywords": [
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"dependencies": {},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/react": "~19.2.0",
|
|
26
|
-
"expo": "56.0.
|
|
27
|
-
"expo-module-scripts": "56.0.
|
|
26
|
+
"expo": "56.0.9",
|
|
27
|
+
"expo-module-scripts": "56.0.3"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"expo": "*",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"jest": {
|
|
35
35
|
"preset": "expo-module-scripts/universal"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "175f1e78e3444ca99ddea473faea6777a0656668",
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "expo-module build",
|
|
40
40
|
"clean": "expo-module clean",
|
package/src/Clipboard.ts
CHANGED
|
@@ -69,6 +69,7 @@ export function hasStringAsync(): Promise<boolean> {
|
|
|
69
69
|
*
|
|
70
70
|
* @returns A promise that fulfills to the URL in the clipboard, or null if no URL is present or permission was denied.
|
|
71
71
|
* @platform ios
|
|
72
|
+
* @platform macos
|
|
72
73
|
*/
|
|
73
74
|
export async function getUrlAsync(): Promise<string | null> {
|
|
74
75
|
if (!ExpoClipboard.getUrlAsync) {
|
|
@@ -86,6 +87,7 @@ export async function getUrlAsync(): Promise<string | null> {
|
|
|
86
87
|
*
|
|
87
88
|
* @param url The URL to save to the clipboard.
|
|
88
89
|
* @platform ios
|
|
90
|
+
* @platform macos
|
|
89
91
|
*/
|
|
90
92
|
export async function setUrlAsync(url: string): Promise<void> {
|
|
91
93
|
if (!ExpoClipboard.setUrlAsync) {
|
|
@@ -99,6 +101,7 @@ export async function setUrlAsync(url: string): Promise<void> {
|
|
|
99
101
|
*
|
|
100
102
|
* @returns A promise that fulfills to `true` if clipboard has URL content, resolves to `false` otherwise.
|
|
101
103
|
* @platform ios
|
|
104
|
+
* @platform macos
|
|
102
105
|
*/
|
|
103
106
|
export async function hasUrlAsync(): Promise<boolean> {
|
|
104
107
|
if (!ExpoClipboard.hasUrlAsync) {
|
|
@@ -171,7 +174,7 @@ export async function hasImageAsync(): Promise<boolean> {
|
|
|
171
174
|
|
|
172
175
|
/**
|
|
173
176
|
* Adds a listener that will fire whenever the content of the user's clipboard changes. This method
|
|
174
|
-
* is a no-op on Web.
|
|
177
|
+
* is a no-op on Web and macOS.
|
|
175
178
|
*
|
|
176
179
|
* @param listener Callback to execute when listener is triggered. The callback is provided a
|
|
177
180
|
* single argument that is an object containing information about clipboard contents.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
d711ee304dfdfb4db2a301f1049d7a8a
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
84c89a419f1b045308a3965202fc986b450607f6
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
63e81f026270daba4af0b733ae152dfff46382cfaa8109dbd24820e9370a4ac9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ff4147e7ad1647f490ea4e1ec0b7a812e7777789f1d0212df157ee9814aee4c81896264d3b21fecca2a98efb755f66f9cb64a6c51dfd2f9c5fec2b992db772e4
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
c55acbb914b696d4a59d560422df950f
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
f64e755c3f4a401145442cf56cd6343bc4cd3957
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ba315ab395da392bab6fe4787ce25edd2d7ade765247f6280cf7860279d9816f
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0cca0f72a7a7617b0218cac5624bf750536ecbb7743d18d653687171b18be538d47a4e8f5edd7d0fdbf05b2c5d0eacf18a612ed1d33118f144785a14a868220a
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|