Skip to content

Commit 5e14f62

Browse files
authored
feat: use react-native-blob-util instead of the react-native-fs and make it optional dependency (#2578)
* feat: use react-native-blob-util instead of the react-native-fs and make it optional dependency * chore: fix peerdeps and add dcos * fix: deps version on package.json * docs: add migration guide for v5 to v6 * docs: add migration guide for v5 to v6 * docs: add migration guide for v5 to v6
1 parent 709d42b commit 5e14f62

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+4916
-1833
lines changed

docusaurus/docs/reactnative/basics/installation.mdx

Lines changed: 219 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import TabItem from '@theme/TabItem';
88

99
Installation and usage of our Stream Chat React Native SDK is simple and involves the following steps:
1010

11-
### Prerequisites
11+
## Prerequisites
1212

1313
First things first, make sure you have set up the development environment for React Native. You can find the official guide [here](https://reactnative.dev/docs/environment-setup).
1414

1515
For Expo, you can follow [this guide](https://docs.expo.dev/get-started/installation/).
1616

17-
### Add Stream's Chat SDK and its peer dependencies
17+
## Add Stream's Chat SDK and its peer dependencies
1818

1919
In order to install the Stream Chat React Native SDK, run the following command in your terminal of choice:
2020

@@ -56,15 +56,15 @@ Stream Chat React Native SDK requires installing some peer dependencies to provi
5656
<TabItem value='rncli'>
5757

5858
```bash title="Terminal"
59-
yarn add @react-native-camera-roll/camera-roll @react-native-community/netinfo @stream-io/flat-list-mvcp react-native-fs react-native-gesture-handler react-native-image-crop-picker @bam.tech/react-native-image-resizer react-native-reanimated react-native-svg
59+
yarn add @react-native-camera-roll/camera-roll @react-native-community/netinfo react-native-gesture-handler react-native-image-crop-picker @bam.tech/react-native-image-resizer react-native-reanimated react-native-svg
6060
```
6161

6262
</TabItem>
6363

6464
<TabItem value='expo'>
6565

6666
```bash title="Terminal"
67-
npx expo install @stream-io/flat-list-mvcp @react-native-community/netinfo expo-file-system expo-image-manipulator expo-image-picker expo-media-library react-native-gesture-handler react-native-reanimated react-native-svg
67+
npx expo install @react-native-community/netinfo expo-image-manipulator expo-image-picker expo-media-library react-native-gesture-handler react-native-reanimated react-native-svg
6868
```
6969

7070
</TabItem>
@@ -83,9 +83,7 @@ values={[
8383
<TabItem value='rncli'>
8484

8585
- [`@react-native-camera-roll/camera-roll`](https://github.com/react-native-cameraroll/react-native-cameraroll) for accessing device gallery.
86-
- [`@react-native-community/netinfo`](https://github.com/react-native-netinfo/react-native-netinfo) for accessing device gallery.
87-
- [`@stream-io/flat-list-mvcp`](https://github.com/GetStream/flat-list-mvcp) for bi-directional FlatList support.
88-
- [`react-native-fs`](https://github.com/itinance/react-native-fs) to perform file operations like save, delete, etc.
86+
- [`@react-native-community/netinfo`](https://github.com/react-native-netinfo/react-native-netinfo) for SDK to respond to network changes.
8987
- [`react-native-gesture-handler`](https://github.com/software-mansion/react-native-gesture-handler) to handle gestures within the SDK.
9088
- [`react-native-image-crop-picker`](https://github.com/ivpusic/react-native-image-crop-picker) to capture images to attach them in the message.
9189
- [`@bam.tech/react-native-image-resizer`](https://github.com/bamlab/react-native-image-resizer) to compress image uploads.
@@ -96,9 +94,7 @@ values={[
9694
<TabItem value="expo">
9795

9896
- [`expo-media-library`](https://docs.expo.dev/versions/latest/sdk/media-library/) for accessing device gallery.
99-
- [`@react-native-community/netinfo`](https://github.com/react-native-netinfo/react-native-netinfo) for accessing device gallery.
100-
- [`@stream-io/flat-list-mvcp`](https://github.com/GetStream/flat-list-mvcp) for bi-directional FlatList support.
101-
- [`expo-file-system`](https://docs.expo.dev/versions/latest/sdk/filesystem/) to perform file operations like save, delete, etc.
97+
- [`@react-native-community/netinfo`](https://github.com/react-native-netinfo/react-native-netinfo) for SDK to respond to network changes.
10298
- [`react-native-gesture-handler`](https://github.com/software-mansion/react-native-gesture-handler) to handle gestures within the SDK.
10399
- [`expo-image-picker`](https://docs.expo.dev/versions/latest/sdk/imagepicker/) to capture images to attach them in the message.
104100
- [`expo-image-manipulator`](https://docs.expo.dev/versions/latest/sdk/imagemanipulator/) to compress image uploads.
@@ -108,9 +104,214 @@ values={[
108104
</TabItem>
109105
</Tabs>
110106

111-
### Optional Dependencies
107+
## Opt-in features
112108

113-
There are a few optional dependencies that can be added to have more features within the SDK.
109+
There are a few features that can be optionally added within the SDK, which would need additional dependencies to be installed. These features are:
110+
111+
### Video playing
112+
113+
Play video and audio attachments within messages in the chat.
114+
115+
<Tabs
116+
defaultValue='rncli'
117+
groupId='rn-platform'
118+
values={[
119+
{ label: 'RN CLI', value: 'rncli' },
120+
{ label: 'Expo', value: 'expo' },
121+
]}
122+
>
123+
<TabItem value='rncli'>
124+
125+
```bash title="Terminal"
126+
yarn add react-native-video
127+
```
128+
129+
</TabItem>
130+
<TabItem value='expo'>
131+
132+
```bash title="Terminal"
133+
npx expo install expo-av
134+
```
135+
136+
</TabItem>
137+
138+
</Tabs>
139+
140+
### Voice recording
141+
142+
Record and send voice messages and play them back within the chat.
143+
144+
<Tabs
145+
defaultValue='rncli'
146+
groupId='rn-platform'
147+
values={[
148+
{ label: 'RN CLI', value: 'rncli' },
149+
{ label: 'Expo', value: 'expo' },
150+
]}
151+
>
152+
<TabItem value='rncli'>
153+
154+
```bash title="Terminal"
155+
yarn add react-native-audio-recorder-player react-native-blob-util
156+
```
157+
158+
</TabItem>
159+
<TabItem value='expo'>
160+
161+
```bash title="Terminal"
162+
npx expo install expo-av
163+
```
164+
165+
</TabItem>
166+
167+
</Tabs>
168+
169+
### Attachment sharing
170+
171+
Share attachments within the message to others.
172+
173+
<Tabs
174+
defaultValue='rncli'
175+
groupId='rn-platform'
176+
values={[
177+
{ label: 'RN CLI', value: 'rncli' },
178+
{ label: 'Expo', value: 'expo' },
179+
]}
180+
>
181+
<TabItem value='rncli'>
182+
183+
```bash title="Terminal"
184+
yarn add react-native-blob-util react-native-share
185+
```
186+
187+
</TabItem>
188+
<TabItem value='expo'>
189+
190+
```bash title="Terminal"
191+
npx expo install expo-sharing
192+
```
193+
194+
</TabItem>
195+
196+
</Tabs>
197+
198+
### Haptic feedback
199+
200+
Provide haptic feedback to the user.
201+
202+
<Tabs
203+
defaultValue='rncli'
204+
groupId='rn-platform'
205+
values={[
206+
{ label: 'RN CLI', value: 'rncli' },
207+
{ label: 'Expo', value: 'expo' },
208+
]}
209+
>
210+
<TabItem value='rncli'>
211+
212+
```bash title="Terminal"
213+
yarn add react-native-haptic-feedback
214+
```
215+
216+
</TabItem>
217+
<TabItem value='expo'>
218+
219+
```bash title="Terminal"
220+
npx expo install expo-haptics
221+
```
222+
223+
</TabItem>
224+
225+
</Tabs>
226+
227+
### Copy message
228+
229+
Copy the text message content to the clipboard.
230+
231+
<Tabs
232+
defaultValue='rncli'
233+
groupId='rn-platform'
234+
values={[
235+
{ label: 'RN CLI', value: 'rncli' },
236+
{ label: 'Expo', value: 'expo' },
237+
]}
238+
>
239+
<TabItem value='rncli'>
240+
241+
```bash title="Terminal"
242+
yarn add @react-native-clipboard/clipboard
243+
```
244+
245+
</TabItem>
246+
<TabItem value='expo'>
247+
248+
```bash title="Terminal"
249+
npx expo install expo-clipboard
250+
```
251+
252+
</TabItem>
253+
254+
</Tabs>
255+
256+
### Share file attachments
257+
258+
Share files from the device within the chat.
259+
260+
<Tabs
261+
defaultValue='rncli'
262+
groupId='rn-platform'
263+
values={[
264+
{ label: 'RN CLI', value: 'rncli' },
265+
{ label: 'Expo', value: 'expo' },
266+
]}
267+
>
268+
<TabItem value='rncli'>
269+
270+
```bash title="Terminal"
271+
yarn add react-native-document-picker
272+
```
273+
274+
</TabItem>
275+
<TabItem value='expo'>
276+
277+
```bash title="Terminal"
278+
npx expo install expo-document-picker
279+
```
280+
281+
</TabItem>
282+
283+
</Tabs>
284+
285+
### Offline support
286+
287+
Enable offline support in the app.
288+
289+
<Tabs
290+
defaultValue='rncli'
291+
groupId='rn-platform'
292+
values={[
293+
{ label: 'RN CLI', value: 'rncli' },
294+
{ label: 'Expo', value: 'expo' },
295+
]}
296+
>
297+
<TabItem value='rncli'>
298+
299+
```bash title="Terminal"
300+
yarn add @op-engineering/op-sqlite
301+
```
302+
303+
</TabItem>
304+
<TabItem value='expo'>
305+
306+
```bash title="Terminal"
307+
npx expo install @op-engineering/op-sqlite
308+
```
309+
310+
</TabItem>
311+
312+
</Tabs>
313+
314+
The overall installation of the optional dependencies would look like this:
114315

115316
<Tabs
116317
defaultValue='rncli'
@@ -124,6 +325,7 @@ values={[
124325

125326
- [`react-native-video`](https://github.com/react-native-video/react-native-video) for Video and Audio playback support.
126327
- [`react-native-audio-recorder-player`](https://github.com/hyochan/react-native-audio-recorder-player) for Audio recording and async audio messages support.
328+
- [`react-native-blob-util`](https://github.com/RonRadtke/react-native-blob-util) to perform file operations like save, delete, while sharing or access the cache directory while audio recording.
127329
- [`react-native-share`](https://github.com/react-native-share/react-native-share) for Attachment sharing support.
128330
- [`react-native-haptic-feedback`](https://github.com/junina-de/react-native-haptic-feedback) for user haptics feedback.
129331
- [`@react-native-clipboard/clipboard`](https://github.com/react-native-clipboard/clipboard) for Copy message support.
@@ -134,6 +336,7 @@ values={[
134336
<TabItem value="expo">
135337

136338
- [`expo-av`](https://docs.expo.dev/versions/latest/sdk/av/) for Video and Audio playback, recording and async audio messages support.
339+
- [`expo-file-system`](https://docs.expo.dev/versions/latest/sdk/filesystem/) to perform file operations like save, delete, while sharing or access the cache directory while audio recording.
137340
- [`expo-sharing`](https://docs.expo.dev/versions/latest/sdk/sharing/) for Attachments sharing support.
138341
- [`expo-haptics`](https://docs.expo.dev/versions/latest/sdk/haptics/) for user haptics support.
139342
- [`expo-clipboard`](https://docs.expo.dev/versions/latest/sdk/clipboard/) for Copy message support.
@@ -147,7 +350,7 @@ values={[
147350
Please follow along the linked documentation of each optional dependencies so as to support them correctly in your application.
148351
:::
149352

150-
### Configuring permissions
353+
## Configuring permissions
151354

152355
Some dependencies(if you are using them on your application), require you to add additional permissions to the `Info.plist` file in iOS and `AndroidManifest.xml` file in Android. Please follow the steps mentioned in the links below for corresponding dependencies:
153356

@@ -232,7 +435,7 @@ For Android on Expo, most of the most permissions are added automatically by lib
232435
</TabItem>
233436
</Tabs>
234437

235-
### Additional Steps
438+
## Additional Steps
236439

237440
Some dependencies require us to make changes to our application for all functionalities to be available.
238441

@@ -327,15 +530,15 @@ values={[
327530
<TabItem value="iOS">
328531

329532
```bash title="Terminal"
330-
yarn ios
533+
yarn run ios
331534
```
332535

333536
</TabItem>
334537

335538
<TabItem value="android">
336539

337540
```bash title="Terminal"
338-
yarn android
541+
yarn run android
339542
```
340543

341544
</TabItem>

0 commit comments

Comments
 (0)