stream-chat-expo 4.7.0-beta.5 → 4.7.0-beta.6

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.7.0-beta.5",
4
+ "version": "4.7.0-beta.6",
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.7.0-beta.5"
13
+ "stream-chat-react-native-core": "4.7.0-beta.6"
14
14
  },
15
15
  "peerDependencies": {
16
16
  "@react-native-community/netinfo": "^6.0.0",
@@ -23,6 +23,9 @@
23
23
  "expo-media-library": "^12.0.2",
24
24
  "expo-sharing": "^9.1.2"
25
25
  },
26
+ "optionalDependencies": {
27
+ "expo-av": "^11.2.3"
28
+ },
26
29
  "scripts": {
27
30
  "prepack": " cp ../../README.md .",
28
31
  "postpack": "rm README.md"
package/src/index.js CHANGED
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { FlatList, Image, Platform } from 'react-native';
3
3
 
4
4
  import NetInfo from '@react-native-community/netinfo';
5
- import { Video as ExpoVideoPlayer } from 'expo-av';
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,6 +12,8 @@ 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';
16
+
15
17
  registerNativeHandlers({
16
18
  compressImage: async ({ compressImageQuality = 1, uri }) => {
17
19
  const { uri: compressedUri } = await ImageManipulator.manipulateAsync(uri, [], {
@@ -220,18 +222,18 @@ registerNativeHandlers({
220
222
  }
221
223
  },
222
224
  // eslint-disable-next-line react/display-name
223
- Video: ({ onPlaybackStatusUpdate, paused, style, uri, videoRef }) => (
224
- <ExpoVideoPlayer
225
- onPlaybackStatusUpdate={onPlaybackStatusUpdate}
226
- ref={videoRef}
227
- resizeMode='contain'
228
- shouldPlay={!paused}
229
- source={{
230
- uri,
231
- }}
232
- style={[style]}
233
- />
234
- ),
225
+ Video: ExpoVideoPlayer ? ({ onPlaybackStatusUpdate, paused, style, uri, videoRef }) => (
226
+ <ExpoVideoPlayer
227
+ onPlaybackStatusUpdate={onPlaybackStatusUpdate}
228
+ ref={videoRef}
229
+ resizeMode='contain'
230
+ shouldPlay={!paused}
231
+ source={{
232
+ uri,
233
+ }}
234
+ style={[style]}
235
+ />
236
+ ) : null,
235
237
  });
236
238
 
237
239
  export * from 'stream-chat-react-native-core';
@@ -0,0 +1,11 @@
1
+ let VideoComponent;
2
+ try {
3
+ const videoPackage = require('expo-av');
4
+ VideoComponent = videoPackage.Video;
5
+ } catch (_) {
6
+ console.warn(
7
+ 'Video library is currently not installed. To allow in-app video playback, install the "expo-av" package.',
8
+ );
9
+ }
10
+
11
+ export default VideoComponent;