stream-chat-react-native 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-react-native",
3
3
  "description": "The official React Native 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"
@@ -11,7 +11,7 @@
11
11
  "types": "types/index.d.ts",
12
12
  "dependencies": {
13
13
  "es6-symbol": "^3.1.3",
14
- "stream-chat-react-native-core": "4.7.0-beta.5"
14
+ "stream-chat-react-native-core": "4.7.0-beta.6"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "@react-native-community/cameraroll": ">=4.0.1",
@@ -23,7 +23,9 @@
23
23
  "react-native-haptic-feedback": ">=1.11.0",
24
24
  "react-native-image-crop-picker": ">=0.33.2",
25
25
  "react-native-image-resizer": ">=1.4.2",
26
- "react-native-share": ">=4.1.0",
26
+ "react-native-share": ">=4.1.0"
27
+ },
28
+ "optionalDependencies": {
27
29
  "react-native-video": "^5.2.0"
28
30
  },
29
31
  "scripts": {
package/src/index.js CHANGED
@@ -8,13 +8,13 @@ import ImagePicker from 'react-native-image-crop-picker';
8
8
  import ImageResizer from 'react-native-image-resizer';
9
9
  import RNShare from 'react-native-share';
10
10
 
11
- import Video from 'react-native-video';
12
-
13
11
  import CameraRoll from '@react-native-community/cameraroll';
14
12
  import NetInfo from '@react-native-community/netinfo';
15
13
  import { FlatList } from '@stream-io/flat-list-mvcp';
16
14
  import { registerNativeHandlers } from 'stream-chat-react-native-core';
17
15
 
16
+ import Video from './optionalDependencies/Video';
17
+
18
18
  registerNativeHandlers({
19
19
  compressImage: async ({ compressImageQuality = 1, height, uri, width }) => {
20
20
  try {
@@ -250,23 +250,24 @@ registerNativeHandlers({
250
250
  });
251
251
  },
252
252
  // eslint-disable-next-line react/display-name
253
- Video: ({ onBuffer, onEnd, onLoad, onProgress, paused, resizeMode, style, uri, videoRef }) => (
254
- <Video
255
- onBuffer={onBuffer}
256
- onEnd={onEnd}
257
- onError={(error) => {
258
- console.error(error);
259
- }}
260
- onLoad={onLoad}
261
- onProgress={onProgress}
262
- paused={paused}
263
- ref={videoRef}
264
- source={{
265
- uri,
266
- }}
267
- style={style}
268
- />
269
- ),
253
+ Video: Video ? ({ onBuffer, onEnd, onLoad, onProgress, paused, style, uri, videoRef }) => (
254
+ <Video
255
+ ignoreSilentSwitch={'ignore'}
256
+ onBuffer={onBuffer}
257
+ onEnd={onEnd}
258
+ onError={(error) => {
259
+ console.error(error);
260
+ }}
261
+ onLoad={onLoad}
262
+ onProgress={onProgress}
263
+ paused={paused}
264
+ ref={videoRef}
265
+ source={{
266
+ uri,
267
+ }}
268
+ style={style}
269
+ />
270
+ ) : null,
270
271
  });
271
272
 
272
273
  if (Platform.OS === 'android') {
@@ -0,0 +1,12 @@
1
+ let VideoComponent;
2
+ try {
3
+ // eslint-disable-next-line no-undef
4
+ const videoPackage = require('react-native-video');
5
+ VideoComponent = videoPackage.default;
6
+ } catch (_) {
7
+ console.warn(
8
+ 'Video library is currently not installed. To allow in-app video playback, install the "react-native-video" package.',
9
+ );
10
+ }
11
+
12
+ export default VideoComponent;