Skip to content

Commit b142a1a

Browse files
authored
Merge pull request #1693 from GetStream/develop
Next release
2 parents 3bc640b + 538871d commit b142a1a

Some content is hidden

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

44 files changed

+1005
-839
lines changed
826 KB
Loading
897 KB
Loading

docusaurus/docs/reactnative/basics/getting_started.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ Most if not all of the required packages now support auto-linking so setup shoul
5757
- [`react-native-image-crop-picker`](https://github.com/ivpusic/react-native-image-crop-picker)
5858
- [`react-native-image-resizer`](https://github.com/bamlab/react-native-image-resizer)
5959
- [`react-native-reanimated`](https://github.com/software-mansion/react-native-reanimated)
60-
- [`react-native-safe-area-context`](https://github.com/th3rdwave/react-native-safe-area-context)
6160
- [`react-native-share`](https://github.com/react-native-share/react-native-share)
6261
- [`react-native-svg`](https://github.com/react-native-svg/react-native-svg)
6362

@@ -71,14 +70,14 @@ Most if not all of the required packages now support auto-linking so setup shoul
7170
<TabItem value='yarn'>
7271

7372
```bash
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
73+
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-share react-native-svg
7574
```
7675

7776
</TabItem>
7877
<TabItem value='npm'>
7978

8079
```bash
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
80+
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-share react-native-svg
8281
```
8382

8483
</TabItem>
@@ -218,7 +217,7 @@ Stream Chat for React Native is set up for parity on Expo, expo requires a diffe
218217

219218
```bash
220219
expo install stream-chat-expo
221-
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
220+
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-svg
222221
```
223222

224223
### Additional Steps

docusaurus/docs/reactnative/basics/offline_support.mdx

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -8,46 +8,49 @@ React Native Chat SDK provides OOTB support for offline mode, which means user w
88
with chat even when the network is off. This is an opt-in feature that needs to be explicitely enabled on application
99
level.
1010

11-
> Offline support is currently not supported for Expo package (stream-chat-expo).
11+
> Offline support is currently not implemented for Expo package (stream-chat-expo).
1212
1313
## Features
1414

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
15+
The offline storage implementation currently offers the following features:
16+
17+
- Access to chat when Internet connection is disabled or low.
18+
- Faster startup times and loading, since initial data is loaded from offline storage before performing any network requests.
19+
- Syncing of the offline database using WebSocket events and Sync API.
20+
21+
The following features are currently **NOT** implemented. They will be implemented gradually as part of minor releases in v5.
22+
23+
- Optimistically update offline database during chat interactions, such as send message, add reaction, etc.
24+
- Access to threads in offline mode.
25+
- Offline caching of attachment images and profile images.
2026

2127
## How To Enable Offline Support
2228

23-
- **Upgrade stream-chat dependency (optional)**
29+
First and foremost make sure to follow all steps from [Migrating to v5](./upgrade_helper.mdx) guide.
30+
To enable offline support, please follow the given steps:
2431

25-
If you have installed `stream-chat` dependency explicitely on your application, then upgrade it to v7
32+
1. **Upgrade stream-chat dependency (optional)**
2633

27-
```bash
28-
29-
```
34+
If you have installed `stream-chat` dependency explicitly on your application, then upgrade it to v7:
35+
36+
```bash
37+
38+
```
3039

31-
- **Add `react-native-quick-sqlite` dependency**
40+
2. **Add `react-native-quick-sqlite` dependency**
3241

33-
```bash
42+
```bash
3443
yarn add react-native-quick-sqlite
3544
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`.
45+
```
4346

44-
- **Do not wait for `connectUser` call to succeed**
47+
3. **Do not wait for `connectUser` call to succeed**
4548

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:
49+
It is important that you call the `connectUser` method on the chat client, before you render Chat components.
50+
But you don't need to wait for `connectUser` to succeed before rendering Chat components. This is to ensure:
4851

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.
52+
- Chat components have access to current user information, which is important to store/access offline data.
53+
- In case of slow or no network access, Chat components will still load the chat data without waiting for `connectUser` to succeed.
5154

5255
```tsx {7,8,16}
5356
const chatClient = StreamChat.getInstance('API_KEY');
@@ -75,26 +78,26 @@ level.
7578
};
7679
```
7780

78-
- **Add `enableOfflineSupport` prop on Chat component**
81+
4. **Add `enableOfflineSupport` prop on Chat component**
7982

80-
```tsx
81-
import { Chat } from 'stream-chat-react-native';
83+
```tsx
84+
import { Chat } from 'stream-chat-react-native';
8285

83-
<Chat client={chatClient} enableOfflineSupport>
84-
...
85-
</Chat>;
86-
```
86+
<Chat client={chatClient} enableOfflineSupport>
87+
...
88+
</Chat>;
89+
```
8790

88-
- **Reset the database when signing out the user**
91+
-5. **Reset the database when signing out the user**
8992

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+
Since the SDK doesn't handle app-level authentication logic, it's the application's responsibility
94+
to ensure the database is reset when a user gets logged out. This should generally be done before you
95+
call `client.disconnectUser()`.
9396

94-
```jsx
95-
import { QuickSqliteClient } from 'stream-chat-react-native';
97+
```tsx
98+
import { QuickSqliteClient } from 'stream-chat-react-native';
9699

97-
// Sign out logic
98-
QuickSqliteClient.resetDB();
99-
chatClient.disconnectUser();
100-
```
100+
// Sign out logic
101+
QuickSqliteClient.resetDB();
102+
chatClient.disconnectUser();
103+
```

docusaurus/docs/reactnative/basics/troubleshooting.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ allprojects {
174174
}
175175

176176
google()
177-
jcenter()
178177
maven { url 'https://maven.google.com' }
179178
maven { url 'https://www.jitpack.io' }
180179
}

docusaurus/docs/reactnative/basics/upgrade_helper.mdx

Lines changed: 11 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ title: Upgrading from V4
66
import Tabs from '@theme/Tabs';
77
import TabItem from '@theme/TabItem';
88

9+
This guide highlights the changes introduced from v4 to v5.
10+
911
## Prop or Context Changes
1012

11-
Following values in [`ImageGalleryContext`](https://getstream.io/chat/docs/sdk/reactnative/v5/contexts/image-gallery-context/#value) have been renamed
13+
The following values in [`ImageGalleryContext`](https://getstream.io/chat/docs/sdk/reactnative/v5/contexts/image-gallery-context/#value) have been renamed:
1214

1315
- `image` -> `selectedMessage`
1416
- `setImage` -> `setSelectedMessage`
@@ -17,114 +19,25 @@ Following values in [`ImageGalleryContext`](https://getstream.io/chat/docs/sdk/r
1719

1820
## Dependency Changes
1921

20-
- If you have installed `stream-chat` dependency explicitly on your application, then upgrade it to v7
22+
- If you have installed `stream-chat` dependency explicitly in your application, then upgrade it to v7:
2123

2224
```bash
2325
2426
```
2527

26-
- Replace [`@react-native-community/cameraroll`](https://github.com/react-native-cameraroll/react-native-cameraroll) dependency with [`@react-native-camera-roll/camera-roll`](https://www.npmjs.com/package/@react-native-camera-roll/camera-roll)
28+
- Replace [`@react-native-community/cameraroll`](https://github.com/react-native-cameraroll/react-native-cameraroll) dependency with [`@react-native-camera-roll/camera-roll`](https://www.npmjs.com/package/@react-native-camera-roll/camera-roll):
2729

2830
```bash
2931
yarn remove @react-native-community/cameraroll
3032
yarn add @react-native-camera-roll/camera-roll
3133
```
3234

33-
## Enable Offline Support
34-
35-
Offline Support is a major opt-in feature introduced in v5 of SDK.
36-
37-
> Offline support is currently not implemented for Expo package (stream-chat-expo).
38-
39-
Offline storage implementation currently offers following features:
40-
41-
- access to chat when internet is disabled
42-
- faster loading of chat since chat gets loaded from offline storage first before loading data from network
43-
- syncing of database using websocket events and sync api.
44-
45-
Following features are currently **NOT** implemented. They will be implemented gradually as part of minor releases in v5.
46-
47-
- optimistically update offline database during chat interactions such as send message, add reactions etc.
48-
- access to threads in offline mode
49-
- offline caching of attachment images and user images
50-
51-
To enable offline support please follow the given steps:
52-
53-
- **Upgrade stream-chat dependency (optional)**
54-
55-
If you have installed `stream-chat` dependency explicitly on your application, then upgrade it to v7
56-
57-
```bash
58-
59-
```
60-
61-
- **Add `react-native-quick-sqlite` dependency**
62-
63-
```bash
64-
yarn add react-native-quick-sqlite
65-
npx pod-install
66-
```
35+
## Unique Chat Component Instance
6736

68-
- **Ensure unique instance of Chat component**
37+
Until v4, you could provide a separate `Chat` component for each usage of `Channel` component or `ChannelList` component.
38+
But from v5, you must provide only one instance of the `Chat` component within your application.
39+
This component needs to be a parent for all the chat-related components such as `ChannelList`, `Channel` or `Thread`.
6940

70-
Until v4, you could provide separate `Chat` component for each usage of `Channel` component or `ChannelList` component.
71-
But from v5, it is necessary that you provide only one instance of `Chat` component within your application.
72-
This component needs to be a parent for all the chat related components such as `ChannelList`, `Channel` or `Thread`.
73-
74-
- **Do not wait for `connectUser` call to succeed**
75-
76-
It is important that you call `connectUser` method on chat client, before you render Chat components.
77-
But you don't need to wait for `connectUser` to succeed before rendering Chat components. This is to ensure:
78-
79-
- Chat components have access to current user information, which is important to store/access offline data.
80-
- In case of slow or no network, Chat components will still load the chat data without waiting for connectUser to succeed.
81-
82-
```tsx {7,8,16}
83-
const chatClient = StreamChat.getInstance('API_KEY');
84-
const App = () => {
85-
const [isClientReady, setIsClientReady] = useState(false);
86-
87-
useEffect(() => {
88-
const startChat = async () => {
89-
const connectPromise = chatClient.connectUser(user, tokenOrTokenProvider);
90-
setIsClientReady(true); // this allows components to render
91-
await connectPromise();
92-
// Any other post-connectUser logic you may have goes here.
93-
};
94-
95-
startChat();
96-
}, []);
97-
98-
if (!isClientReady) return null; // or some loading indicator;
99-
100-
return (
101-
<Chat client={chatClient} enableOfflineSupport>
102-
...
103-
</Chat>
104-
);
105-
};
106-
```
107-
108-
- **Add `enableOfflineSupport` prop on Chat component**
109-
110-
```tsx
111-
import { Chat } from 'stream-chat-react-native';
112-
113-
<Chat client={chatClient} enableOfflineSupport>
114-
...
115-
</Chat>;
116-
```
117-
118-
- **Reset the database when signing out the user**
119-
120-
Since SDK doesn't handle the app level authentication logic, its application's responsibility
121-
to ensure resetting database when user gets logged out. This should be generally done before you
122-
call `client.disconnectUser()`
123-
124-
```jsx
125-
import { QuickSqliteClient } from 'stream-chat-react-native';
41+
## Enable Offline Support
12642

127-
// Sign out logic
128-
QuickSqliteClient.resetDB();
129-
chatClient.disconnectUser();
130-
```
43+
To enable offline support please check the [Offline Support](./offline_support.mdx) guide.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
id: debug-mode-using-flipper-plugin
3+
sidebar_position: 2
4+
title: Debug Stream Chat Application using Flipper plugin
5+
---
6+
7+
import FlipperBanner from '../assets/guides/debug-mode-using-flipper-plugin/flipper_stream_chat_react_native_banner.png';
8+
import FlipperDesktopGuide from '../assets/guides/debug-mode-using-flipper-plugin/flipper_desktop_guide.png';
9+
10+
## Overview
11+
12+
Flipper is a platform for debugging iOS, Android, and React Native apps. You can debug Stream Chat within your application using our Flipper Desktop app interface. This plugin will help you analyze multiple parameters of your application which are part of the Stream Chat React Native interface.
13+
14+
<img src={FlipperBanner} />
15+
16+
## Features
17+
18+
The plugin supports the following features:
19+
20+
- Viewing the authenticated client in the Chat.
21+
- Viewing the Channels, Message, and Thread list data as you navigate the app.
22+
- Copying and visualizing all the data.
23+
24+
These features are part of the 1st version of this plugin; more features will be added in the future. If you have any ideas/suggestions, please reach out via the [SDK's discussions page](https://github.com/GetStream/stream-chat-react-native/discussions).
25+
26+
## Installation Instructions
27+
28+
1. First, install the Flipper plugin within your Desktop client. To do so, follow these steps:
29+
30+
- Download the Flipper Desktop app from [here](https://fbflipper.com/).
31+
- After downloading the desktop app, move to the **Plugin Manager** section of the app and select the **Install Plugins** tab.
32+
- Search for **stream-chat-react-native**, and you will find the plugin.
33+
- Click on **Install** to install it.
34+
35+
{' '}
36+
37+
<img src={FlipperDesktopGuide} />
38+
39+
2. Next, install `stream-chat-react-native-devtools` to your application as a dev dependency. This dependency will make communication possible between the RN Stream Chat SDK and the Flipper plugin.
40+
41+
```
42+
yarn add --dev stream-chat-react-native-devtools
43+
```
44+
45+
or
46+
47+
```
48+
npm install --save-dev stream-chat-react-native-devtools
49+
```
50+
51+
3. To interact with the Flipper Plugin you need an additional dependency `react-native-flipper`. You can install it as a dev dependency, as:
52+
53+
```
54+
yarn add --dev react-native-flipper
55+
```
56+
57+
or
58+
59+
```
60+
npm install --save-dev react-native-flipper
61+
```
62+
63+
4. Wrap the root of the component tree with `DebugContextProvider` and pass the `useFlipper` function.
64+
65+
```tsx
66+
import { DebugContextProvider } from 'stream-chat-react-native';
67+
import { useFlipper } from 'stream-chat-react-native-devtools';
68+
...
69+
70+
<DebugContextProvider useFlipper={useFlipper}>
71+
{/* All other elements of the App component comes here */}
72+
</DebugContextProvider>
73+
```
74+
75+
Kudos 🎉, everything else is handled by our SDK, the package [stream-chat-react-native-devtools](https://www.npmjs.com/package/stream-chat-react-native-devtools), and the [Flipper Plugin](https://www.npmjs.com/package/flipper-plugin-stream-chat-react-native).

docusaurus/docs/reactnative/guides/push_notifications_v2.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ Follow the steps below to setup your apps with Firebase:
5959

6060
### Expo
6161

62-
For bare workflow, all of the installation steps above will suffice. For custom managed workflow, please see [the expo installation docs at React Native Firebase](https://rnfirebase.io/#expo). React Native Firebase cannot be used in the "Expo Go" app because [it is not possible to include custom native code](https://docs.expo.dev/bare/using-expo-client/). If you are using "Expo Go" app and want notifications, you can achieve this using [Webhooks](https://getstream.io/chat/docs/react-native/webhooks_overview/?language=javascript) and a third-party push provider. See [this article](https://support.getstream.io/hc/en-us/articles/1500006478421-How-can-I-use-the-Stream-Webhook-to-send-customers-emails-based-on-Chat-events-) for an example.
62+
:::note
63+
64+
If you're using Bare Workflow, please follow the installation steps above.
65+
66+
:::
67+
68+
React Native Firebase library is not available in the [Expo Go](https://expo.dev/client) app by default due to including much-needed native code. However, you can get things working via the [expo-dev-client](https://docs.expo.dev/development/getting-started/) library and adding [config plugins](https://docs.expo.dev/guides/config-plugins/). Please follow the [expo installation docs at React Native Firebase](https://rnfirebase.io/#installation-1) for the details.
6369

6470
## Get Google Service Account Credentials
6571

docusaurus/docs/reactnative/ui-components/overlay_reactions.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ List of existing reactions which can be extracted from a message.
2424
```tsx
2525
const reactions = message.latest_reactions.map(reaction => ({
2626
alignment: clientId && clientId === reaction.user?.id ? 'right' : 'left',
27+
id: reaction?.user?.id || '',
2728
image: reaction?.user?.image,
2829
name: reaction?.user?.name || reaction.user_id || '',
2930
type: reaction.type,

0 commit comments

Comments
 (0)