stream-chat-expo 5.12.1-beta.2 → 5.12.1

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": "5.12.1-beta.2",
4
+ "version": "5.12.1",
5
5
  "author": {
6
6
  "company": "Stream.io Inc",
7
7
  "name": "Stream.io Inc"
@@ -10,7 +10,7 @@
10
10
  "main": "src/index.js",
11
11
  "types": "types/index.d.ts",
12
12
  "dependencies": {
13
- "stream-chat-react-native-core": "5.12.1-beta.2"
13
+ "stream-chat-react-native-core": "5.12.1"
14
14
  },
15
15
  "peerDependencies": {
16
16
  "@react-native-community/netinfo": ">=6.0.0",
@@ -21,20 +21,33 @@
21
21
  "expo-image-manipulator": "*",
22
22
  "expo-image-picker": ">=14.1.0",
23
23
  "expo-media-library": "*",
24
- "expo-sharing": "*"
24
+ "expo-sharing": "*",
25
+ "expo-av": "*"
26
+ },
27
+ "peerDependenciesMeta": {
28
+ "expo-av": {
29
+ "optional": true
30
+ },
31
+ "expo-clipboard": {
32
+ "optional": true
33
+ },
34
+ "expo-document-picker": {
35
+ "optional": true
36
+ },
37
+ "expo-sharing": {
38
+ "optional": true
39
+ },
40
+ "expo-haptics": {
41
+ "optional": true
42
+ }
25
43
  },
26
44
  "devDependencies": {
27
45
  "@react-native-community/netinfo": "^6.0.0",
28
46
  "expo": "^44.0.0",
29
- "expo-av": "^12.0.4",
30
- "expo-clipboard": "^3.1.0",
31
- "expo-document-picker": "^9.1.2",
32
47
  "expo-file-system": "^11.0.2",
33
- "expo-haptics": "^10.0.0",
34
48
  "expo-image-manipulator": "^9.1.0",
35
- "expo-image-picker": "14.1.1",
36
- "expo-media-library": "^12.0.2",
37
- "expo-sharing": "^9.1.2"
49
+ "expo-image-picker": "^14.1.1",
50
+ "expo-media-library": "^12.0.2"
38
51
  },
39
52
  "scripts": {
40
53
  "prepack": " cp ../../README.md .",
@@ -1,14 +1,8 @@
1
- import type { AVPlaybackSource, AVPlaybackStatus, AVPlaybackStatusToSet } from 'expo-av';
2
-
3
1
  import { AudioComponent } from '../optionalDependencies/Video';
4
2
 
5
3
  export const Sound = {
6
4
  initializeSound: AudioComponent
7
- ? async (
8
- source: AVPlaybackSource,
9
- initialStatus: AVPlaybackStatusToSet,
10
- onPlaybackStatusUpdate: (playbackStatus: AVPlaybackStatus) => void,
11
- ) => {
5
+ ? async (source, initialStatus, onPlaybackStatusUpdate: (playbackStatus) => void) => {
12
6
  const { sound } = await AudioComponent.Sound.createAsync(
13
7
  source,
14
8
  initialStatus,
@@ -1,4 +1,4 @@
1
- import { VideoComponent } from '../optionalDependencies/Video';
1
+ import { VideoComponent } from '../optionalDependencies';
2
2
 
3
3
  export const Video = VideoComponent
4
4
  ? ({ onPlaybackStatusUpdate, paused, resizeMode, style, uri, videoRef }) => (
@@ -3,12 +3,8 @@ export * from './deleteFile';
3
3
  export * from './getLocalAssetUri';
4
4
  export * from './getPhotos';
5
5
  export * from './NetInfo';
6
- export * from './pickDocument';
7
6
  export * from './saveFile';
8
- export * from './setClipboardString';
9
- export * from './shareImage';
10
7
  export * from './Sound';
11
8
  export * from './takePhoto';
12
- export * from './triggerHaptic';
13
9
  export * from './Video';
14
10
  export * from './oniOS14GalleryLibrarySelectionChange';
package/src/index.js CHANGED
@@ -9,16 +9,19 @@ import {
9
9
  getPhotos,
10
10
  NetInfo,
11
11
  oniOS14GalleryLibrarySelectionChange,
12
- pickDocument,
13
12
  saveFile,
14
- setClipboardString,
15
- shareImage,
16
13
  Sound,
17
14
  takePhoto,
18
- triggerHaptic,
19
15
  Video,
20
16
  } from './handlers';
21
17
 
18
+ import {
19
+ pickDocument,
20
+ setClipboardString,
21
+ shareImage,
22
+ triggerHaptic,
23
+ } from './optionalDependencies';
24
+
22
25
  registerNativeHandlers({
23
26
  compressImage,
24
27
  deleteFile,
@@ -0,0 +1,5 @@
1
+ export * from './setClipboardString';
2
+ export * from './shareImage';
3
+ export * from './pickDocument';
4
+ export * from './triggerHaptic';
5
+ export * from './Video';
@@ -0,0 +1,28 @@
1
+ let DocumentPicker;
2
+
3
+ try {
4
+ DocumentPicker = require('expo-document-picker').default;
5
+ } catch (error) {
6
+ console.log('expo-document-picker is not installed');
7
+ }
8
+
9
+ export const pickDocument = DocumentPicker
10
+ ? async () => {
11
+ try {
12
+ const { type, ...rest } = await DocumentPicker.getDocumentAsync();
13
+ if (type === 'cancel') {
14
+ return {
15
+ cancelled: true,
16
+ };
17
+ }
18
+ return {
19
+ cancelled: false,
20
+ docs: [rest],
21
+ };
22
+ } catch (err) {
23
+ return {
24
+ cancelled: true,
25
+ };
26
+ }
27
+ }
28
+ : null;
@@ -0,0 +1,12 @@
1
+ let Clipboard: { setString: (string: string) => void } | undefined;
2
+
3
+ try {
4
+ Clipboard = require('expo-clipboard').default;
5
+ } catch (e) {
6
+ // do nothing
7
+ console.log('expo-clipboard is not installed');
8
+ }
9
+
10
+ export const setClipboardString = Clipboard
11
+ ? (string: string) => Clipboard?.setString(string)
12
+ : null;
@@ -0,0 +1,18 @@
1
+ let Sharing;
2
+
3
+ try {
4
+ Sharing = require('expo-sharing').default;
5
+ } catch (error) {
6
+ console.log('expo-sharing is not installed');
7
+ }
8
+
9
+ export const shareImage = Sharing
10
+ ? async ({ type, url }: { type: string; url: string }) => {
11
+ try {
12
+ await Sharing.shareAsync(url, { mimeType: type, UTI: type });
13
+ return true;
14
+ } catch (error) {
15
+ console.warn('Sharing failed or cancelled...');
16
+ }
17
+ }
18
+ : null;
@@ -0,0 +1,42 @@
1
+ let Haptics;
2
+
3
+ try {
4
+ Haptics = require('expo-haptics').default;
5
+ } catch (error) {
6
+ console.log('expo-haptics is not installed');
7
+ }
8
+
9
+ type HapticFeedbackTypes =
10
+ | 'impactHeavy'
11
+ | 'impactLight'
12
+ | 'impactMedium'
13
+ | 'notificationError'
14
+ | 'notificationSuccess'
15
+ | 'notificationWarning';
16
+
17
+ export const triggerHaptic = Haptics
18
+ ? (method: HapticFeedbackTypes) => {
19
+ switch (method) {
20
+ case 'impactHeavy':
21
+ Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Heavy);
22
+ break;
23
+ case 'impactLight':
24
+ Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
25
+ break;
26
+ case 'impactMedium':
27
+ Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium);
28
+ break;
29
+ case 'notificationError':
30
+ Haptics.notificationAsync(Haptics.NotificationFeedbackType.Error);
31
+ break;
32
+ case 'notificationSuccess':
33
+ Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success);
34
+ break;
35
+ case 'notificationWarning':
36
+ Haptics.notificationAsync(Haptics.NotificationFeedbackType.Warning);
37
+ break;
38
+ default:
39
+ Haptics.selectionAsync();
40
+ }
41
+ }
42
+ : () => {};
@@ -1,20 +0,0 @@
1
- import * as DocumentPicker from 'expo-document-picker';
2
-
3
- export const pickDocument = async () => {
4
- try {
5
- const { type, ...rest } = await DocumentPicker.getDocumentAsync();
6
- if (type === 'cancel') {
7
- return {
8
- cancelled: true,
9
- };
10
- }
11
- return {
12
- cancelled: false,
13
- docs: [rest],
14
- };
15
- } catch (err) {
16
- return {
17
- cancelled: true,
18
- };
19
- }
20
- };
@@ -1,10 +0,0 @@
1
- let Clipboard: { setString: (string: string) => void } | undefined;
2
-
3
- try {
4
- Clipboard = require('expo-clipboard');
5
- } catch (e) {
6
- // do nothing
7
- }
8
-
9
- export const setClipboardString =
10
- Clipboard !== undefined ? (string: string) => Clipboard.setString(string) : null;
@@ -1,10 +0,0 @@
1
- import * as Sharing from 'expo-sharing';
2
-
3
- export const shareImage = async ({ type, url }: { type: string; url: string }) => {
4
- try {
5
- await Sharing.shareAsync(url, { mimeType: type, UTI: type });
6
- return true;
7
- } catch (error) {
8
- console.warn('Sharing failed or cancelled...');
9
- }
10
- };
@@ -1,34 +0,0 @@
1
- import * as Haptics from 'expo-haptics';
2
-
3
- type HapticFeedbackTypes =
4
- | 'impactHeavy'
5
- | 'impactLight'
6
- | 'impactMedium'
7
- | 'notificationError'
8
- | 'notificationSuccess'
9
- | 'notificationWarning';
10
-
11
- export const triggerHaptic = (method: HapticFeedbackTypes) => {
12
- switch (method) {
13
- case 'impactHeavy':
14
- Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Heavy);
15
- break;
16
- case 'impactLight':
17
- Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
18
- break;
19
- case 'impactMedium':
20
- Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium);
21
- break;
22
- case 'notificationError':
23
- Haptics.notificationAsync(Haptics.NotificationFeedbackType.Error);
24
- break;
25
- case 'notificationSuccess':
26
- Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success);
27
- break;
28
- case 'notificationWarning':
29
- Haptics.notificationAsync(Haptics.NotificationFeedbackType.Warning);
30
- break;
31
- default:
32
- Haptics.selectionAsync();
33
- }
34
- };