stream-chat-expo 4.11.1-beta.2 → 4.12.0-beta.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": "4.11.1-beta.2",
4
+ "version": "4.12.0-beta.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": "4.11.1-beta.2"
13
+ "stream-chat-react-native-core": "4.12.0-beta.1"
14
14
  },
15
15
  "peerDependencies": {
16
16
  "@react-native-community/netinfo": "^6.0.0",
package/src/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
+
2
3
  import { FlatList, Image, Platform } from 'react-native';
3
4
 
4
5
  import NetInfo from '@react-native-community/netinfo';
5
-
6
6
  import * as DocumentPicker from 'expo-document-picker';
7
7
  import * as FileSystem from 'expo-file-system';
8
8
  import * as Haptics from 'expo-haptics';
@@ -12,7 +12,7 @@ import * as MediaLibrary from 'expo-media-library';
12
12
  import * as Sharing from 'expo-sharing';
13
13
  import { registerNativeHandlers } from 'stream-chat-react-native-core';
14
14
 
15
- import ExpoVideoPlayer from './optionalDependencies/Video';
15
+ import { AudioComponent, VideoComponent } from './optionalDependencies/Video';
16
16
 
17
17
  registerNativeHandlers({
18
18
  compressImage: async ({ compressImageQuality = 1, uri }) => {
@@ -109,7 +109,6 @@ registerNativeHandlers({
109
109
  pickDocument: async ({ maxNumberOfFiles }) => {
110
110
  try {
111
111
  const { type, ...rest } = await DocumentPicker.getDocumentAsync();
112
-
113
112
  if (type === 'cancel') {
114
113
  return {
115
114
  cancelled: true,
@@ -143,6 +142,19 @@ registerNativeHandlers({
143
142
  throw new Error('Sharing failed or cancelled...');
144
143
  }
145
144
  },
145
+ Sound: {
146
+ initializeSound: AudioComponent
147
+ ? async (source, initialStatus, onPlaybackStatusUpdate) => {
148
+ const { sound } = await AudioComponent.Sound.createAsync(
149
+ source,
150
+ initialStatus,
151
+ onPlaybackStatusUpdate,
152
+ );
153
+ return sound;
154
+ }
155
+ : null,
156
+ Player: null,
157
+ },
146
158
  takePhoto: async ({ compressImageQuality = 1 }) => {
147
159
  try {
148
160
  const permissionCheck = await ImagePicker.getCameraPermissionsAsync();
@@ -223,18 +235,20 @@ registerNativeHandlers({
223
235
  }
224
236
  },
225
237
  // eslint-disable-next-line react/display-name
226
- Video: ExpoVideoPlayer ? ({ onPlaybackStatusUpdate, paused, style, uri, videoRef }) => (
227
- <ExpoVideoPlayer
228
- onPlaybackStatusUpdate={onPlaybackStatusUpdate}
229
- ref={videoRef}
230
- resizeMode='contain'
231
- shouldPlay={!paused}
232
- source={{
233
- uri,
234
- }}
235
- style={[style]}
236
- />
237
- ) : null,
238
+ Video: VideoComponent
239
+ ? ({ onPlaybackStatusUpdate, paused, style, uri, videoRef }) => (
240
+ <VideoComponent
241
+ onPlaybackStatusUpdate={onPlaybackStatusUpdate}
242
+ ref={videoRef}
243
+ resizeMode='contain'
244
+ shouldPlay={!paused}
245
+ source={{
246
+ uri,
247
+ }}
248
+ style={[style]}
249
+ />
250
+ )
251
+ : null,
238
252
  });
239
253
 
240
254
  export * from 'stream-chat-react-native-core';
@@ -1,11 +1,13 @@
1
1
  let VideoComponent;
2
+ let AudioComponent;
2
3
  try {
3
- const videoPackage = require('expo-av');
4
- VideoComponent = videoPackage.Video;
4
+ const audioVideoPackage = require('expo-av');
5
+ VideoComponent = audioVideoPackage.Video;
6
+ AudioComponent = audioVideoPackage.Audio;
5
7
  } catch (_) {
6
8
  console.warn(
7
- 'Video library is currently not installed. To allow in-app video playback, install the "expo-av" package.',
9
+ 'Audio Video library is currently not installed. To allow in-app audio or video playback, install the "expo-av" package.',
8
10
  );
9
11
  }
10
12
 
11
- export default VideoComponent;
13
+ export { AudioComponent, VideoComponent };