stream-chat-expo 8.13.16 → 8.13.18

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stream-chat-expo",
3
3
  "description": "The official Expo SDK for Stream Chat, a service for building chat applications",
4
- "version": "8.13.16",
4
+ "version": "8.13.18",
5
5
  "author": {
6
6
  "company": "Stream.io Inc",
7
7
  "name": "Stream.io Inc"
@@ -16,7 +16,7 @@
16
16
  "types": "types/index.d.ts",
17
17
  "dependencies": {
18
18
  "mime": "^4.0.7",
19
- "stream-chat-react-native-core": "8.13.16"
19
+ "stream-chat-react-native-core": "8.13.18"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "expo": ">=51.0.0",
@@ -1,4 +1,9 @@
1
- let Clipboard: { setString: (string: string) => void } | undefined;
1
+ let Clipboard:
2
+ | {
3
+ setString?: (text: string) => void;
4
+ setStringAsync?: (text: string) => Promise<boolean>;
5
+ }
6
+ | undefined;
2
7
 
3
8
  try {
4
9
  Clipboard = require('expo-clipboard');
@@ -12,6 +17,23 @@ if (!Clipboard) {
12
17
  );
13
18
  }
14
19
 
15
- export const setClipboardString = Clipboard
16
- ? (string: string) => Clipboard?.setString(string)
17
- : null;
20
+ export const setClipboardString =
21
+ Clipboard && (Clipboard.setStringAsync || Clipboard.setString)
22
+ ? (text: string) => {
23
+ try {
24
+ // `expo-clipboard` removed the synchronous `setString` in favour of
25
+ // the async API. Keep this handler synchronous (void return, like the
26
+ // legacy `setString`) and fire the async write without awaiting. Fall
27
+ // back to `setString` for older versions.
28
+ if (Clipboard?.setStringAsync) {
29
+ Clipboard.setStringAsync(text).catch((error: unknown) => {
30
+ console.log('Copying to clipboard failed...', error);
31
+ });
32
+ } else {
33
+ Clipboard?.setString?.(text);
34
+ }
35
+ } catch (error) {
36
+ console.log('Copying to clipboard failed...', error);
37
+ }
38
+ }
39
+ : null;