Skip to content

Commit 8b0b4f4

Browse files
authored
feat: add new message action list and reaction selector UI (#2686)
1 parent f66b4a0 commit 8b0b4f4

File tree

110 files changed

+2993
-3889
lines changed

Some content is hidden

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

110 files changed

+2993
-3889
lines changed
511 KB
Loading
334 KB
Loading
Binary file not shown.

docusaurus/docs/reactnative/basics/migrating-from-5.x-to-6.x.mdx

Lines changed: 77 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ title: Migration from 5.x to 6.x
77
v6.0 is supported on React native version **0.72** and above.
88
:::
99

10-
## Changes
10+
## Dependency changes
1111

1212
The following are the crucial changes of the Stream Chat React Native SDK from version 5.x to 6.x:
1313

14-
### Change `react-native-fs` to `react-native-blob-util`
14+
#### Change `react-native-fs` to `react-native-blob-util`
1515

1616
The `react-native-fs` package has been replaced to `react-native-blob-util` in favour of the former not being actively maintained. You can replace it by running the following commands:
1717

@@ -20,7 +20,7 @@ yarn remove react-native-fs
2020
yarn add react-native-blob-util
2121
```
2222

23-
### Change `react-native-image-resizer` to `@bam.tech/react-native-image-resizer`
23+
#### Change `react-native-image-resizer` to `@bam.tech/react-native-image-resizer`
2424

2525
The `react-native-image-resizer` package has been replaced with `@bam.tech/react-native-image-resizer`.
2626

@@ -33,7 +33,7 @@ yarn remove react-native-image-resizer
3333
yarn add @bam.tech/react-native-image-resizer
3434
```
3535

36-
### Change `react-native-image-crop-picker` to `react-native-image-picker`
36+
#### Change `react-native-image-crop-picker` to `react-native-image-picker`
3737

3838
The `react-native-image-crop-picker` package has been replaced with `react-native-image-picker`. This is a better alternative, and can help us with our new architecture endeavors.
3939

@@ -46,7 +46,7 @@ yarn add react-native-image-picker
4646

4747
Also, the dependency is made optional now, so if you don't want to use the image picker, you can remove it from your project and the camera selector icon on the Attachment picker will be simply hidden for you.
4848

49-
### Change `react-native-quick-sqlite` to `op-sqlite`
49+
#### Change `react-native-quick-sqlite` to `op-sqlite`
5050

5151
The `react-native-quick-sqlite` package has been replaced with `op-sqlite`. This is a faster alternative, and can help us with our new architecture endeavors.
5252

@@ -57,7 +57,7 @@ yarn remove react-native-quick-sqlite
5757
yarn add op-sqlite
5858
```
5959

60-
### Remove the usage of `@stream-io/flat-list-mvcp`
60+
#### Remove the usage of `@stream-io/flat-list-mvcp`
6161

6262
The dependency on `@stream-io/flat-list-mvcp` package has been removed in favour of React Native's [`FlatList`](https://reactnative.dev/docs/flatlist) component supporting [`maintainVisibleContentPosition`](https://reactnative.dev/docs/scrollview#maintainvisiblecontentposition) from React Native version `>=0.72`. You can replace it by using the `FlatList` component directly.
6363

@@ -78,7 +78,68 @@ registerNativeHandlers({
7878

7979
This also involves not passing the `FlatList` component as a handler to [`registerNativeHandlers`](../customization/native-handlers.mdx#overriding-handlers) anymore.
8080

81-
### Remove `NetInfo` from the native handlers
81+
## SDK changes
82+
83+
#### Introduce new Message Menu design
84+
85+
The Message Menu design has been revamped to provide a better user experience. The new design is more intuitive and provides a better user experience.
86+
87+
![Message Menu](../assets/basics/migrating-from-5.x-to-6.x/message_actions.png)
88+
89+
:::note
90+
The previous overlay design has been replaced with a bottom sheet modal design.
91+
:::
92+
93+
#### Removed `MessageOverlayContext` and `MessageOverlayProvider`
94+
95+
The `MessageOverlayContext` and `MessageOverlayProvider` have been removed.
96+
97+
#### Removed props from `OverlayProvider`
98+
99+
The following props have been removed from the `OverlayProvider`:
100+
101+
- `MessageActionList`
102+
- `MessageActionListItem`
103+
- `OverlayReactions`
104+
- `OverlayReactionsAvatar`
105+
- `OverlayReactionsItem`
106+
- `messageTextNumberOfLines`
107+
- `error`, `isMyMessage`, `isThreadMessage`, `message` and `messageReactions`
108+
109+
#### New `Channel` props
110+
111+
The props from the `OverlayProvider` have been moved to the `Channel` component. The following props have been added to the `Channel` component:
112+
113+
- `MessageActionList`
114+
- `MessageActionListItem`
115+
- `OverlayReactions` is changed to `MessageUserReactions`
116+
- `OverlayReactionsAvatar` is changed to `MessageUserReactionsAvatar`
117+
- `OverlayReactionsItem` is changed to `MessageUserReactionsItem`
118+
- `messageTextNumberOfLines`
119+
120+
#### Removed `MessageOverlay` in favour of `MessageMenu`.
121+
122+
The `MessageOverlay` component has been removed in favour of `MessageMenu`. The `MessageMenu` component is a more versatile and feature-rich component that can be used to show more than just reactions and actions.
123+
124+
The `MessageOverlay` component is removed from top level `OverlayProvider` and is replaced with `MessageMenu` in the level of the `Message` component.
125+
126+
#### Remove prop from `Message` component.
127+
128+
The following props have been removed from the `Message` component:
129+
130+
- `setData`
131+
- `setOverlay`
132+
- `onLongPress`
133+
- `onPress`
134+
- `onPressIn`
135+
136+
The later 3 props are removed in favour of similar props on MessagesContext and is therefore not needed. The `setData` prop is removed in favour of the removal of `MessageOverlayContext` and the `setOverlay` is not needed as we don't set the message overlay in `OverlayProvider`.
137+
138+
#### Added `BottomSheetModal` component
139+
140+
The version introduces a very basic `BottomSheetModal` component that can be used to show a modal at the bottom of the screen. This can be used to show the message actions and reactions.
141+
142+
#### Remove `NetInfo` from the native handlers
82143

83144
The `NetInfo` package has been removed from the native handlers. This also involves not passing the `NetInfo` utility as a handler to [`registerNativeHandlers`](../customization/native-handlers.mdx#overriding-handlers) anymore.
84145

@@ -91,6 +152,14 @@ registerNativeHandlers({
91152
});
92153
```
93154

94-
### Change the type of `quotedMessage` in `MessageInputContext`
155+
#### Change the type of `quotedMessage` in `MessageInputContext`
95156

96157
The type of `quotedMessage` is changed from `MessageType | boolean` to `MessageType | undefined` for better in the `MessageInputContext`.
158+
159+
## Other changes
160+
161+
- The `useMessageActions` hook doesn't take `setOverlay` anymore but takes in `dismissOverlay`.
162+
- The MessageContext has a new prop - `dismissOverlay`. The definition of `showMessageOverlay` is changed to `(showMessageReactions?: boolean) => void`.
163+
- The `isMessageActionsVisible` is changed to `showMessageReactions` in `messageAction.ts`.
164+
- Removed the `useMessageActionAnimation` hook.
165+
- Removed `alignment` prop from `MessagePinnedHeader` component.

docusaurus/docs/reactnative/basics/navigation.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import TabItem from '@theme/TabItem';
88

99
Stream Chat for React Native provides many features out of the box that require positioning the components on the screen in a certain manner to get the desired UI.
1010

11-
The `AttachmentPicker``ImageGallery`, and `MessageOverlay`, all need to be rendered in front of other components to have the desired effect. All of these elements are controlled by the `OverlayProvider`. When used together with navigation, certain steps are needed to be taken to make these components appear fluently.
11+
The `AttachmentPicker` and  `ImageGallery`, all need to be rendered in front of other components to have the desired effect. All of these elements are controlled by the `OverlayProvider`. When used together with navigation, certain steps are needed to be taken to make these components appear fluently.
1212

1313
The guidance provided makes the assumption you are using [React Navigation](https://reactnavigation.org/) in your app in conjunction with [`createStackNavigator`](https://reactnavigation.org/docs/stack-navigator/).
1414

docusaurus/docs/reactnative/basics/troubleshooting.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ To do this make sure your `Channel` components are always aware of the thread st
7979

8080
## Image gallery not full screen
8181

82-
If the image viewer or message overlay is not covering the full screen, for instance it is rendering below or behind a Header, it is likely the `OverlayProvider` is not setup in the correct location within the application.
82+
If the image viewer or message menu is not covering the full screen, for instance it is rendering below or behind a Header, it is likely the `OverlayProvider` is not setup in the correct location within the application.
8383
Please refer to the [Stream Chat with Navigation](./navigation.mdx) documentation to properly place the `OverlayProvider` in relation to your navigation solution or other components.
8484

8585
## Image picker incorrect height
@@ -295,7 +295,7 @@ This includes ensuring you import `react-native-gesture-handler` at the top of y
295295
import 'react-native-gesture-handler';
296296
```
297297

298-
Also do not forget to wrap your component tree(probably above `OverlayProvider`) with `<GestureHandlerRootView>` or `gestureHandlerRootHOC` as mentioned in [RNGH Installation docs](https://docs.swmansion.com/react-native-gesture-handler/docs/installation#js). Not doing so, can cause unusual behaviour with the `MessageOverlay` and `Imagegallery` gestures.
298+
Also do not forget to wrap your component tree(probably above `OverlayProvider`) with `<GestureHandlerRootView>` or `gestureHandlerRootHOC` as mentioned in [RNGH Installation docs](https://docs.swmansion.com/react-native-gesture-handler/docs/installation#js). Not doing so, can cause unusual behaviour with the `Imagegallery` gestures.
299299

300300
```tsx
301301
<GestureHandlerRootView style={{ flex: 1 }}>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Function to open the message action overlay. This function gets called when user long presses a message.
22

3-
| Type |
4-
| -------- |
5-
| function |
3+
| Type |
4+
| ------------------------------------------ |
5+
| `(showMessageReactions?: boolean) => void` |

docusaurus/docs/reactnative/common-content/contexts/message-overlay-context/data.mdx

Lines changed: 0 additions & 83 deletions
This file was deleted.

docusaurus/docs/reactnative/common-content/ui-components/channel/props/handle_reaction.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Function called when a reaction is selected in the message overlay, this is called on both the add and remove action.
1+
Function called when a reaction is selected in the message menu, this is called on both the add and remove action.
22
This function does not override the default behavior of the reaction being selected.
33
Please refer to [the guide on customizing message actions](../../../../guides/custom-message-actions.mdx) for details.
44

docusaurus/docs/reactnative/common-content/ui-components/overlay-provider/props/message_action_list_item.mdx renamed to docusaurus/docs/reactnative/common-content/ui-components/channel/props/message-action-list-item.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Component for rendering message action list items within a message action list.
22

3-
| Type | Default |
4-
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
5-
| ComponentType | [MessageActionListItem](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageOverlay/MessageActionListItem.tsx) |
3+
| Type | Default |
4+
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
5+
| ComponentType | [`MessageActionListItem`](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageMenu/MessageActionListItem.tsx) \| `undefined` |

0 commit comments

Comments
 (0)