Skip to content

Commit 0989c45

Browse files
authored
Merge branch 'develop' into khushal87-crns-430
2 parents a9e8102 + 56c7875 commit 0989c45

File tree

32 files changed

+390
-214
lines changed

32 files changed

+390
-214
lines changed

docusaurus/docs/reactnative/basics/getting_started.mdx

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This should be considered a primer before delving into the UI and Core Component
1616

1717
Your [environment should be setup](https://reactnative.dev/docs/environment-setup) and a project created prior to beginning the installation.
1818

19-
### Add dependencies
19+
### Add Required dependencies
2020

2121
Install the required packages in your React Native project.
2222

@@ -151,14 +151,22 @@ For some of the packages listed below, there are additional steps required to se
151151
- `react-native` - [additional installation steps](https://reactnative.dev/docs/image#gif-and-webp-support-on-android)
152152
- `react-native-image-crop-picker` - [additional installation steps](https://github.com/ivpusic/react-native-image-crop-picker#step-3)
153153
- `react-native-cameraroll` - [additional installation steps](https://github.com/react-native-cameraroll/react-native-cameraroll#permissions)
154-
- `react-native-video` - [additional installation steps](https://github.com/react-native-video/react-native-video/blob/master/API.md#installation)
155154

156155
:::note
157156

158157
If you are planning to use file picker functionality, make sure you enable iCloud capability in your app - [Enable iCloud capability](https://camo.githubusercontent.com/ac300ca7e3bbab573a76c151469a89efd8b31e72/68747470733a2f2f33313365353938373731386233343661616638332d66356538323532373066323961383466373838313432333431303338343334322e73736c2e6366312e7261636b63646e2e636f6d2f313431313932303637342d656e61626c652d69636c6f75642d64726976652e706e67)
159158

160159
:::
161160

161+
### Add Optional Dependencies
162+
163+
- `react-native-video` - [additional installation steps](https://github.com/react-native-video/react-native-video/blob/master/API.md#installation)
164+
165+
> Available in stream-chat-react-native >= v4.7.0
166+
167+
Installing this package allows you to play the video files/attachments in the chat. Otherwise by default, video files will be opened in default
168+
browser of the device.
169+
162170
### AndroidX Support
163171

164172
> AndroidX is a major step forward in the Android ecosystem, and the old support library artifacts are being deprecated.
@@ -172,9 +180,67 @@ But an awesome tool named [jetifier](https://github.com/mikehardy/jetifier) is q
172180

173181
## Expo Installation
174182

175-
Stream Chat for React Native is set up for parity on Expo, expo requires a different set of dependencies than bare React Native, in your project directory run:
183+
Stream Chat for React Native is set up for parity on Expo, expo requires a different set of dependencies than bare React Native, in your project directory run.
184+
185+
### Add Required Dependencies
176186

177187
```bash
178188
expo install stream-chat-expo
179189
expo install @react-native-community/netinfo expo-document-picker expo-file-system expo-haptics expo-image-manipulator expo-image-picker expo-media-library expo-sharing react-native-gesture-handler react-native-reanimated react-native-safe-area-context react-native-svg expo-av
180190
```
191+
192+
### Additional Steps
193+
194+
For some of the packages listed below, there are additional steps required to setup the package:
195+
196+
- `react-native-reanimated` - [additional installation steps](https://docs.expo.dev/versions/latest/sdk/reanimated/#installation)
197+
198+
Add Reanimated's babel plugin to your babel.config.js:
199+
200+
```js
201+
module.exports = {
202+
...
203+
plugins: [
204+
...
205+
'react-native-reanimated/plugin',
206+
],
207+
};
208+
```
209+
210+
- `react-native-gesture-handler` - [additional installation steps](https://docs.expo.dev/versions/latest/sdk/gesture-handler/#api)
211+
212+
RNGH requires the package to be imported at the **top of the entry file** before anything else, this is usually your `App.js` or `index.js` file.
213+
214+
```tsx
215+
import 'react-native-gesture-handler';
216+
import { AppRegistry } from 'react-native';
217+
218+
import App from './App';
219+
import { name as appName } from './app.json';
220+
221+
AppRegistry.registerComponent(appName, () => App);
222+
```
223+
224+
Also wrap your entry point with `<GestureHandlerRootView>` or `gestureHandlerRootHO`
225+
226+
```jsx
227+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
228+
import { OverlayProvider } from 'stream-chat-react-native';
229+
230+
export default function App() {
231+
return (
232+
<GestureHandlerRootView>
233+
<OverlayProvider>{/* Your app code goes here */}</OverlayProvider>
234+
</GestureHandlerRootView>
235+
);
236+
}
237+
```
238+
239+
### Add Optional Dependencies
240+
241+
- `expo-av` - [additional installation steps](https://docs.expo.dev/versions/v45.0.0/sdk/video/)
242+
243+
> Available in stream-chat-expo >= v4.7.0
244+
245+
Installing this package allows you to play the video files/attachments in the chat. Otherwise by default, video files will be opened in default
246+
browser of the device.

examples/SampleApp/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Change Log
22

3+
## [1.7.0](https://github.com/GetStream/stream-chat-react-native/compare/[email protected]@v1.7.0) (2022-06-07)
4+
5+
6+
### Features
7+
8+
* allow video upload from image picker and file picker ([6009d36](https://github.com/GetStream/stream-chat-react-native/commit/6009d3626bed416c1bd043fbf1c6ebb156186677))
9+
* inline video renderer/player support for SDK ([862c4bb](https://github.com/GetStream/stream-chat-react-native/commit/862c4bb990f98f26c6c81e2335692569a44018b9))
10+
11+
12+
### Workspaces
13+
14+
* Following linked packages updated: [stream-chat-react-native]
15+
316
### [1.6.1](https://github.com/GetStream/stream-chat-react-native/compare/[email protected]@v1.6.1) (2022-05-25)
417

518

examples/SampleApp/ios/SampleApp.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@
514514
CLANG_ENABLE_MODULES = YES;
515515
CODE_SIGN_ENTITLEMENTS = SampleApp/SampleAppDebug.entitlements;
516516
CODE_SIGN_IDENTITY = "iPhone Developer";
517-
CURRENT_PROJECT_VERSION = 110;
517+
CURRENT_PROJECT_VERSION = 116;
518518
DEVELOPMENT_TEAM = EHV7XZLAHA;
519519
ENABLE_BITCODE = NO;
520520
INFOPLIST_FILE = SampleApp/Info.plist;
@@ -545,7 +545,7 @@
545545
CODE_SIGN_ENTITLEMENTS = SampleApp/SampleAppRelease.entitlements;
546546
CODE_SIGN_IDENTITY = "iPhone Distribution";
547547
CODE_SIGN_STYLE = Manual;
548-
CURRENT_PROJECT_VERSION = 110;
548+
CURRENT_PROJECT_VERSION = 116;
549549
DEVELOPMENT_TEAM = EHV7XZLAHA;
550550
INFOPLIST_FILE = SampleApp/Info.plist;
551551
LD_RUNPATH_SEARCH_PATHS = (

examples/SampleApp/ios/SampleApp/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.5.0</string>
20+
<string>1.6.1</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>
24-
<string>110</string>
24+
<string>116</string>
2525
<key>LSRequiresIPhoneOS</key>
2626
<true />
2727
<key>NSAppTransportSecurity</key>

examples/SampleApp/ios/SampleAppTests/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
<key>CFBundlePackageType</key>
1616
<string>BNDL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.5.0</string>
18+
<string>1.6.1</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>110</string>
22+
<string>116</string>
2323
</dict>
2424
</plist>

examples/SampleApp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sampleapp",
3-
"version": "1.6.1",
3+
"version": "1.7.0",
44
"private": true,
55
"repository": {
66
"type": "git",

package/CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Change Log
22

3+
## [4.7.0](https://github.com/GetStream/stream-chat-react-native/compare/v4.6.1...v4.7.0) (2022-06-07)
4+
5+
6+
### Features
7+
8+
* ability to customize onPress handler for urls ([e5b840f](https://github.com/GetStream/stream-chat-react-native/commit/e5b840f07983c71cc58322194c5b62ebbefa9252))
9+
* allow video upload from image picker and file picker ([6009d36](https://github.com/GetStream/stream-chat-react-native/commit/6009d3626bed416c1bd043fbf1c6ebb156186677))
10+
* inline video renderer/player support for SDK ([862c4bb](https://github.com/GetStream/stream-chat-react-native/commit/862c4bb990f98f26c6c81e2335692569a44018b9))
11+
12+
13+
### Bug Fixes
14+
15+
* correctly truncate channel name in useChannelPreviewDisplayName ([cdabaa3](https://github.com/GetStream/stream-chat-react-native/commit/cdabaa3682747c3590df37a2ad86380c67e0ef29))
16+
* filePicker appearing issue on tapping the attachment picker icon after file is selected ([ae19950](https://github.com/GetStream/stream-chat-react-native/commit/ae19950b397b5e999e10c9ae7f1a41ad5dfdec12))
17+
* issue with the link text overflowing the reply view ([1c5aa3e](https://github.com/GetStream/stream-chat-react-native/commit/1c5aa3eac161f115a4c6799dfecd48966f770c06))
18+
* issues with video upload in expo from attachment picker and component displayname ([d8d621d](https://github.com/GetStream/stream-chat-react-native/commit/d8d621d0754d0d7962791a8756142955b2d661d6))
19+
* smart gallery rendering while optimistically adding a message to list ([748f36b](https://github.com/GetStream/stream-chat-react-native/commit/748f36b7db4ce69c8d39cad24d9588359b6346f3))
20+
321
### [4.6.1](https://github.com/GetStream/stream-chat-react-native/compare/v4.6.0...v4.6.1) (2022-05-25)
422

523

package/expo-package/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "stream-chat-expo",
33
"description": "The official Expo SDK for Stream Chat, a service for building chat applications",
4-
"version": "4.6.1",
4+
"version": "4.7.0",
55
"author": {
66
"company": "Stream.io Inc",
77
"name": "Stream.io Inc"
@@ -10,7 +10,7 @@
1010
"main": "src/index.js",
1111
"types": "types/index.d.ts",
1212
"dependencies": {
13-
"stream-chat-react-native-core": "4.6.1"
13+
"stream-chat-react-native-core": "4.7.0"
1414
},
1515
"peerDependencies": {
1616
"@react-native-community/netinfo": "^6.0.0",
@@ -23,6 +23,9 @@
2323
"expo-media-library": "^12.0.2",
2424
"expo-sharing": "^9.1.2"
2525
},
26+
"optionalDependencies": {
27+
"expo-av": "^11.2.3"
28+
},
2629
"scripts": {
2730
"prepack": " cp ../../README.md .",
2831
"postpack": "rm README.md"

package/expo-package/src/index.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import { FlatList, Image, Platform } from 'react-native';
33

44
import NetInfo from '@react-native-community/netinfo';
5-
import { Video as ExpoVideoPlayer } from 'expo-av';
5+
66
import * as DocumentPicker from 'expo-document-picker';
77
import * as FileSystem from 'expo-file-system';
88
import * as Haptics from 'expo-haptics';
@@ -12,6 +12,8 @@ import * as MediaLibrary from 'expo-media-library';
1212
import * as Sharing from 'expo-sharing';
1313
import { registerNativeHandlers } from 'stream-chat-react-native-core';
1414

15+
import ExpoVideoPlayer from './optionalDependencies/Video';
16+
1517
registerNativeHandlers({
1618
compressImage: async ({ compressImageQuality = 1, uri }) => {
1719
const { uri: compressedUri } = await ImageManipulator.manipulateAsync(uri, [], {
@@ -220,18 +222,18 @@ registerNativeHandlers({
220222
}
221223
},
222224
// 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,
235237
});
236238

237239
export * from 'stream-chat-react-native-core';
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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;

0 commit comments

Comments
 (0)