You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docusaurus/docs/React/contexts/channel-state-context.mdx
+45-3Lines changed: 45 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ title: ChannelStateContext
5
5
---
6
6
7
7
The `ChannelStateContext` is a one of the context providers exposed in the [`Channel`](../core-components/channel.mdx) component and is consumable by all of the `Channel` children components.
8
-
The context provides all of the state properties and logic for a `channel`, and you can access these by calling the `useChannelStateContext` custom hook.
8
+
The context provides all the state properties and logic for a `channel`, and you can access these by calling the `useChannelStateContext` custom hook.
9
9
10
10
## Basic Usage
11
11
@@ -67,20 +67,37 @@ Error object (if any) in loading the `channel`, otherwise null.
If the channel has more messages to paginate through.
78
+
If the channel has more, older, messages to paginate through.
79
79
80
80
| Type |
81
81
| ------- |
82
82
| boolean |
83
83
84
+
85
+
### hasMoreNewer
86
+
87
+
If the channel has more, newer, messages to paginate through.
88
+
89
+
| Type |
90
+
| ------- |
91
+
| boolean |
92
+
93
+
#### highlightedMessageId
94
+
95
+
Value is used internally for jump-to-message logic. Once the user "jumped" to the message, the message with the given ID is highlighted by manipulating its styles attribute.
96
+
97
+
| Type |
98
+
|--------|
99
+
| string |
100
+
84
101
### loading
85
102
86
103
Boolean for the `channel` loading state.
@@ -97,6 +114,14 @@ Boolean for the `channel` loading more messages.
97
114
| ------- |
98
115
| boolean |
99
116
117
+
### loadingMoreNewer?
118
+
119
+
Flag signalling whether newer messages are being loaded as the user scrolls down in the message list. Used internally by `VirtualizedMessageList`.
120
+
121
+
| Type |
122
+
|---------|
123
+
| boolean |
124
+
100
125
### maxNumberOfFiles
101
126
102
127
The maximum number of attachments allowed per `message`, defaults to the Stream Chat API maximum.
@@ -169,6 +194,15 @@ The read state for each `channel` member.
169
194
| ------ |
170
195
| object |
171
196
197
+
198
+
### suppressAutoscroll
199
+
200
+
Flag signalling whether the scroll to the bottom is prevented. Used internally by `MessageList` and `VirtualizedMessageList` components.
201
+
202
+
| Type |
203
+
|---------|
204
+
| boolean |
205
+
172
206
### thread
173
207
174
208
The parent message for a `thread`, if there is one, otherwise null.
@@ -201,6 +235,14 @@ Array of messages within a `thread`.
201
235
| -------- |
202
236
| object[]|
203
237
238
+
### threadSuppressAutoscroll
239
+
240
+
Flag signalling whether the scroll to the bottom is prevented in thread. Used internally by `MessageList` and `VirtualizedMessageList` components.
Copy file name to clipboardExpand all lines: docusaurus/docs/React/custom-code-examples/override-submit-handler.mdx
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,12 +19,13 @@ function.
19
19
You do not have to implement your custom submit handler, if the only thing you need is to pass custom message data to the underlying API call. In that case you can use the [`handleSubmit`](https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageInput/hooks/useSubmitHandler.ts) function from the [`MessageInputContext`](../contexts/message-input-context.mdx). The `handleSubmit` function allows you to pass custom message data through its second parameter `customMessageData`. This applies to sending a new message as well as updating an existing one. In order for this to work, you will have to implement custom message input components and pass them to [`Channel`](../core-components/channel.mdx) props `EditMessageInput` or `Input` respectively.
20
20
:::
21
21
22
-
The `overrideSubmitHandler` function receives two arguments, the message to be sent and the `cid` (channel type prepended to channel id)
23
-
for the currently active channel. The message object is of the following type:
22
+
The `overrideSubmitHandler` function receives three arguments, the message to be sent, the `cid` (channel type prepended to channel id)
23
+
for the currently active channel and optionally custom message data. The message object (the first argument) is of the following type:
The ChannelPreview UI component receives props via the [`ChannelPreview`](./channel-preview.mdx) wrapper, and
8
10
these props are a combination of the `ChannelPreview` props with additional UI specific items. The wrapper also handles the required logic
9
-
while the UI component is responsible for the UI display and the click functionality for channel selection.
11
+
while the UI component is responsible for the UI display and the click functionality for channel selection.
10
12
11
13
This UI component is set via the `Preview` prop on `ChannelList`, and if nothing is provided then the default is used, [`ChannelPreviewMessenger`](https://github.com/GetStream/stream-chat-react/blob/master/src/components/ChannelPreview/ChannelPreviewMessenger.tsx).
12
14
@@ -54,11 +56,11 @@ The currently selected channel object.
54
56
55
57
### Avatar
56
58
57
-
The custom UI component to display the an avatar for the channel.
59
+
The custom UI component to display the avatar for the channel.
@@ -68,6 +70,13 @@ A number that forces the update of the preview component on channel update.
68
70
| ------ |
69
71
| number |
70
72
73
+
### className
74
+
75
+
Custom class for the channel preview root
76
+
77
+
| Type |
78
+
|--------|
79
+
| string |
71
80
72
81
### displayImage
73
82
@@ -99,13 +108,21 @@ Latest message preview to display. Will be either a string or a JSX.Element rend
99
108
| --------------------- |
100
109
| string \| JSX.Element |
101
110
111
+
### onSelect
112
+
113
+
Custom handler invoked when the `ChannelPreview` is clicked. The SDK uses `ChannelPreview` to display items of channel search results. There, behind the scenes, the new active channel is set.
The `ChannelPreview` component is a wrapper component that handles the logic and functionality for a provided (or the default) channel preview and ultimately dictates the display via the component's `Preview` prop.
8
10
9
11
## Basic Usage
@@ -16,9 +18,9 @@ This prop from the parent component ultimately sets the `Preview` prop in `Chann
This required prop is the `channel` to be previewed; comes from either the `channelRenderFilterFn` or `usePaginatedChannels` call from
38
40
[ChannelList](https://github.com/GetStream/stream-chat-react/blob/master/src/components/ChannelList/ChannelList.tsx) and does not need to be set manually.
@@ -51,11 +53,11 @@ The currently selected channel object.
51
53
52
54
### Avatar
53
55
54
-
The custom UI component to display the an avatar for the `channel`.
56
+
The custom UI component to display the avatar for the `channel`.
@@ -65,13 +67,30 @@ A number that forces the update of the preview component on channel update.
65
67
| ------ |
66
68
| number |
67
69
70
+
### className
71
+
72
+
Custom class for the channel preview root
73
+
74
+
| Type |
75
+
|--------|
76
+
| string |
77
+
78
+
79
+
### onSelect
80
+
81
+
Custom handler invoked when the `ChannelPreview` is clicked. The SDK uses `ChannelPreview` to display items of channel search results. There, behind the scenes, the new active channel is set.
0 commit comments