Skip to content

Commit b3633ef

Browse files
Merge pull request #1675 from GetStream/develop
Next Major Release
2 parents 4b83caa + 038ae45 commit b3633ef

File tree

627 files changed

+21762
-2588
lines changed

Some content is hidden

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

627 files changed

+21762
-2588
lines changed

.github/workflows/docusaurus.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ name: docusaurus
33
on:
44
push:
55
branches:
6-
# - main # default branch name for each repo that docs should be push from
7-
# - develop
8-
- v5.0.0-beta
6+
- main # default branch name for each repo that docs should be push from
7+
- develop
98
paths:
109
- docusaurus/**
1110
jobs:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ artifacts
44
e2e/.env
55
*.log
66
.DS_STORE
7+
*.db
8+
.idea

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
22
"editor.formatOnSave": true
3-
}
3+
}

bin/release.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ cd ..
3030
sed -e 's|"version": "[^"]*"|"version": "'"$1"'"|g' -i.bak src/version.json
3131
rm src/version.json.bak
3232

33+
git add package.json
3334
git add {expo,native}-package/package.json
3435
git add src/version.json
3536

37+
git add yarn.lock
3638
git add expo-package/yarn.lock
3739
git add native-package/yarn.lock
3840

39-
npm version "$1" --force
41+
npm version --no-git-tag-version "$1"
4042

4143
npm publish --tag="$tag"
4244

@@ -45,6 +47,4 @@ npm publish --tag="$tag"
4547

4648

4749
cd ../expo-package
48-
npm publish --tag="$tag"
49-
50-
git push --follow-tags
50+
npm publish --tag="$tag"

docusaurus/docs/reactnative/basics/getting_started.mdx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Stream Chat has a number of peer dependencies that are required to take advantag
4747
It is suggested you follow the install instructions for each package to ensure it is properly setup.
4848
Most if not all of the required packages now support auto-linking so setup should be minimal. Those with known [additional steps](#additional-steps) have been noted.
4949

50-
- [`@react-native-community/cameraroll`](https://github.com/react-native-cameraroll/react-native-cameraroll)
50+
- [`@react-native-camera-roll/camera-roll`](https://github.com/react-native-cameraroll/react-native-cameraroll)
5151
- [`@react-native-community/netinfo`](https://github.com/react-native-netinfo/react-native-netinfo)
5252
- [`@stream-io/flat-list-mvcp`](https://github.com/GetStream/flat-list-mvcp)
5353
- [`react-native-document-picker`](https://github.com/rnmods/react-native-document-picker)
@@ -71,27 +71,28 @@ Most if not all of the required packages now support auto-linking so setup shoul
7171
<TabItem value='yarn'>
7272

7373
```bash
74-
yarn add @react-native-community/cameraroll @react-native-community/netinfo @stream-io/flat-list-mvcp react-native-document-picker react-native-fs react-native-gesture-handler react-native-haptic-feedback react-native-haptic-feedback react-native-image-crop-picker react-native-image-resizer react-native-reanimated react-native-safe-area-context react-native-share react-native-svg
74+
yarn add @react-native-camera-roll/camera-roll @react-native-community/netinfo @stream-io/flat-list-mvcp react-native-document-picker react-native-fs react-native-gesture-handler react-native-haptic-feedback react-native-haptic-feedback react-native-image-crop-picker react-native-image-resizer react-native-reanimated react-native-safe-area-context react-native-share react-native-svg
7575
```
7676

7777
</TabItem>
7878
<TabItem value='npm'>
7979

8080
```bash
81-
npm install @react-native-community/cameraroll @react-native-community/netinfo @stream-io/flat-list-mvcp react-native-document-picker react-native-fs react-native-gesture-handler react-native-haptic-feedback react-native-haptic-feedback react-native-image-crop-picker react-native-image-resizer react-native-reanimated react-native-safe-area-context react-native-share react-native-svg
81+
npm install @react-native-camera-roll/camera-roll @react-native-community/netinfo @stream-io/flat-list-mvcp react-native-document-picker react-native-fs react-native-gesture-handler react-native-haptic-feedback react-native-haptic-feedback react-native-image-crop-picker react-native-image-resizer react-native-reanimated react-native-safe-area-context react-native-share react-native-svg
8282
```
8383

8484
</TabItem>
8585
</Tabs>
8686

8787
For iOS on a Mac install the pods `npx pod-install ios`.
8888

89-
#### Version compabilities
89+
#### Version compatibilities
9090

9191
To be able to use the Stream Chat React Native SDK, a few dependencies must meet the following version requirements:
9292

9393
| react-native | stream-chat-react-native (min required) | react-native-reanimated (min required) |
9494
| ------------ | --------------------------------------- | -------------------------------------- |
95+
| 0.69 | 4.13.0 | 2.9.1 |
9596
| 0.68 | 4.11.0 | 2.7.0 |
9697
| 0.67 | 4.2.0 | 2.4.0 |
9798
| 0.66 | 3.9.0 | 2.2.3 |
@@ -150,7 +151,7 @@ For some of the packages listed below, there are additional steps required to se
150151

151152
- `react-native` - [additional installation steps](https://reactnative.dev/docs/image#gif-and-webp-support-on-android)
152153
- `react-native-image-crop-picker` - [additional installation steps](https://github.com/ivpusic/react-native-image-crop-picker#step-3)
153-
- `react-native-cameraroll` - [additional installation steps](https://github.com/react-native-cameraroll/react-native-cameraroll#permissions)
154+
- `react-native-camera-roll` - [additional installation steps](https://github.com/react-native-cameraroll/react-native-cameraroll#permissions)
154155

155156
:::note
156157

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
id: offline-support
3+
sidebar_position: 6
4+
title: Offline Support
5+
---
6+
7+
React Native Chat SDK provides OOTB support for offline mode, which means user will be able to access and interact
8+
with chat even when the network is off. This is an opt-in feature that needs to be explicitely enabled on application
9+
level.
10+
11+
> Offline support is currently not supported for Expo package (stream-chat-expo).
12+
13+
## Features
14+
15+
- ✅ Access to channel list and message list without network
16+
- ✅ Faster loading of chat since chat gets loaded from offline storage first before loading data from network
17+
- ✅ Syncing the local database using websocket events and sync api (once network is recovered)
18+
- ❌ Caching of image attachments
19+
- ❌ Optimistic updates to database on user action in offline mode e.g., send message, add reaction etc
20+
21+
## How To Enable Offline Support
22+
23+
- **Upgrade stream-chat dependency (optional)**
24+
25+
If you have installed `stream-chat` dependency explicitely on your application, then upgrade it to v7
26+
27+
```bash
28+
29+
```
30+
31+
- **Add `react-native-quick-sqlite` dependency**
32+
33+
```bash
34+
yarn add react-native-quick-sqlite
35+
npx pod-install
36+
```
37+
38+
- **Ensure unique instance of Chat component**
39+
40+
Until v4, you could provide separate `Chat` component for each usage of `Channel` component or `ChannelList` component.
41+
But from v5, it is necessary that you provide only one instance of `Chat` component within your application.
42+
This component needs to be a parent for all the chat related components such as `ChannelList`, `Channel` or `Thread`.
43+
44+
- **Do not wait for `connectUser` call to succeed**
45+
46+
It is important that you call `connectUser` method on chat client, before you render Chat components.
47+
But you don't need to wait for `connectUser` to succeed before rendering Chat components. This is to ensure:
48+
49+
- Chat components have access to current user information, which is important to store/access offline data.
50+
- In case or slow or no network, Chat components will still load the chat data without waiting for connectUser to succeed.
51+
52+
```tsx {7,8,16}
53+
const chatClient = StreamChat.getInstance('API_KEY');
54+
const App = () => {
55+
const [isClientReady, setIsClientReady] = useState(false);
56+
57+
useEffect(() => {
58+
const startChat = async () => {
59+
const connectPromise = chatClient.connectUser(user, tokenOrTokenProvider);
60+
setIsClientReady(true); // this allows components to render
61+
await connectPromise();
62+
// Any other post-connectUser logic you may have goes here.
63+
};
64+
65+
startChat();
66+
}, []);
67+
68+
if (!isClientReady) return null; // or some loading indicator;
69+
70+
return (
71+
<Chat client={chatClient} enableOfflineSupport>
72+
...
73+
</Chat>
74+
);
75+
};
76+
```
77+
78+
- **Add `enableOfflineSupport` prop on Chat component**
79+
80+
```tsx
81+
import { Chat } from 'stream-chat-react-native';
82+
83+
<Chat client={chatClient} enableOfflineSupport>
84+
...
85+
</Chat>;
86+
```
87+
88+
- **Reset the database when signing out the user**
89+
90+
Since SDK doesn't handle the app level authentication logic, its application's responsibility
91+
to ensure resetting database when user gets logged out. This should be generally done before you
92+
call `client.disconnectUser()`
93+
94+
```jsx
95+
import { QuickSqliteClient } from 'stream-chat-react-native';
96+
97+
// Sign out logic
98+
QuickSqliteClient.resetDB();
99+
chatClient.disconnectUser();
100+
```

docusaurus/docs/reactnative/basics/translations.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ const { t, tDateTimeParser } = await streami18n.getTranslators();
392392
Allows you to register a custom translation, this will override a translation if one already exists for the given language code.
393393
The third parameter, which is optional, is a Day.js locale, which is structured the same as [dayjsLocaleConfigForLanguage](#dayjslocaleconfigforlanguage).
394394

395-
It is suggested you look at the [`enTranslations` json file](https://github.com/GetStream/stream-chat-react-native/tree/main/src/i18n) exported from `stream-chat-react-native` for a current list of used translation keys.
395+
It is suggested you look at the [`enTranslations` json file](https://github.com/GetStream/stream-chat-react/blob/master/src/i18n/en.json) exported from `stream-chat-react-native` for a current list of used translation keys.
396396

397397
```ts
398398
streami18n.registerTranslation('mr', {

docusaurus/docs/reactnative/basics/troubleshooting.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: troubleshooting
3-
sidebar_position: 6
3+
sidebar_position: 7
44
title: Troubleshooting
55
---
66

0 commit comments

Comments
 (0)