stream-chat-expo 9.7.3-beta.2 → 9.7.3-beta.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/README.md
CHANGED
|
@@ -68,10 +68,9 @@ For complete pricing details visit our [Chat Pricing Page](https://getstream.io/
|
|
|
68
68
|
|
|
69
69
|
## 🔮 Example Apps
|
|
70
70
|
|
|
71
|
-
This repo includes
|
|
71
|
+
This repo includes 2 example apps. One made with Expo, and a more full featured app example built with the React Native CLI.
|
|
72
72
|
|
|
73
73
|
- [Expo example](https://github.com/GetStream/stream-chat-react-native/tree/develop/examples/ExpoMessaging)
|
|
74
|
-
- [Typescript example](https://github.com/GetStream/stream-chat-react-native/tree/develop/examples/TypeScriptMessaging)
|
|
75
74
|
- [Fully featured messaging application](https://github.com/GetStream/stream-chat-react-native/tree/develop/examples/SampleApp)
|
|
76
75
|
|
|
77
76
|
Besides, our team maintains a dedicated repository for fully-fledged sample applications and demos at [GetStream/react-native-samples](https://github.com/GetStream/react-native-samples). Please consider checking following sample applications:
|
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": "9.7.3-beta.
|
|
4
|
+
"version": "9.7.3-beta.4",
|
|
5
5
|
"author": {
|
|
6
6
|
"company": "Stream.io Inc",
|
|
7
7
|
"name": "Stream.io Inc"
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"types": "types/index.d.ts",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"mime": "^4.0.7",
|
|
30
|
-
"stream-chat-react-native-core": "9.7.3-beta.
|
|
30
|
+
"stream-chat-react-native-core": "9.7.3-beta.4"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"expo": ">=52.0.0",
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
type SetClipboardStringOptions = {
|
|
2
|
+
onFailure?: (error: unknown) => void;
|
|
3
|
+
onSuccess?: () => void;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
let Clipboard:
|
|
7
|
+
| {
|
|
8
|
+
setString?: (text: string) => void;
|
|
9
|
+
setStringAsync?: (text: string) => Promise<boolean>;
|
|
10
|
+
}
|
|
11
|
+
| undefined;
|
|
2
12
|
|
|
3
13
|
try {
|
|
4
14
|
Clipboard = require('expo-clipboard');
|
|
@@ -12,6 +22,35 @@ if (!Clipboard) {
|
|
|
12
22
|
);
|
|
13
23
|
}
|
|
14
24
|
|
|
15
|
-
export const setClipboardString =
|
|
16
|
-
|
|
17
|
-
|
|
25
|
+
export const setClipboardString =
|
|
26
|
+
Clipboard && (Clipboard.setStringAsync || Clipboard.setString)
|
|
27
|
+
? (text: string, options?: SetClipboardStringOptions) => {
|
|
28
|
+
try {
|
|
29
|
+
// `expo-clipboard` removed the synchronous `setString` in favour of
|
|
30
|
+
// the async API. Keep this handler synchronous (void return,
|
|
31
|
+
// like the legacy `setString`) and fire the async write without
|
|
32
|
+
// awaiting, reporting the outcome through the callbacks. Fall back to
|
|
33
|
+
// `setString` for older versions.
|
|
34
|
+
if (Clipboard?.setStringAsync) {
|
|
35
|
+
Clipboard.setStringAsync(text)
|
|
36
|
+
.then((success) => {
|
|
37
|
+
if (success) {
|
|
38
|
+
options?.onSuccess?.();
|
|
39
|
+
} else {
|
|
40
|
+
options?.onFailure?.(new Error('Copying to clipboard failed'));
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
.catch((error: unknown) => {
|
|
44
|
+
console.log('Copying to clipboard failed...', error);
|
|
45
|
+
options?.onFailure?.(error);
|
|
46
|
+
});
|
|
47
|
+
} else {
|
|
48
|
+
Clipboard?.setString?.(text);
|
|
49
|
+
options?.onSuccess?.();
|
|
50
|
+
}
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.log('Copying to clipboard failed...', error);
|
|
53
|
+
options?.onFailure?.(error);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
: null;
|