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
|`currentChannels`| The state of loaded `Channel` objects queried thus far. Has to be set with `setChannels` (see below). |
230
230
|`queryType`| A string indicating, whether the channels state has to be reset to the first page ('reload') or newly queried channels should be appended to the `currentChannels`. |
231
231
|`setChannels`| Function that allows us to set the channels state reflected in `currentChannels`. |
232
232
|`setHasNextPage`| Flag indicating whether there are more items to be loaded from the API. Should be infered from the comparison of the query result length and the query options limit. |
233
233
234
234
The function has to:
235
+
235
236
1. build / provide own query filters, sort and options parameters
236
237
2. query and append channels to the current channels state
237
238
3. update the `hasNext` pagination flag after each query with `setChannels` function
238
239
239
240
An example below implements a custom query function that uses different filters sequentially once a preceding filter is exhausted:
Copy file name to clipboardexpand all lines: docusaurus/docs/React/components/utility-components/channel-preview-ui.mdx
+19-3
Original file line number
Diff line number
Diff line change
@@ -18,12 +18,12 @@ For even deeper customization of the channel list and channel previews, use the
18
18
To customize the `ChannelList` item UI simply pass your custom `Preview` component to the `ChannelList`. See [The Preview Prop Component](../../guides/customization/channel-list-preview.mdx#the-preview-prop-component) for the extended guide.
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.
/** Custom UI component to display the container for the queried channels, defaults to and accepts same props as: [ChannelListMessenger](https://github.com/GetStream/stream-chat-react/blob/master/src/components/ChannelList/ChannelListMessenger.tsx) */
/** Custom UI component to display the loading error indicator, defaults to and accepts same props as: [ChatDown](https://github.com/GetStream/stream-chat-react/blob/master/src/components/ChatDown/ChatDown.tsx) */
@@ -29,8 +29,10 @@ export type ChannelPreviewUIComponentProps<
29
29
displayTitle?: string;
30
30
/** The last message received in a channel */
31
31
lastMessage?: StreamMessage<StreamChatGenerics>;
32
-
/** Latest message preview to display, will be a string or JSX element supporting markdown. */
32
+
/** @deprecated Use latestMessagePreview prop instead. */
33
33
latestMessage?: string|JSX.Element;
34
+
/** Latest message preview to display, will be a string or JSX element supporting markdown. */
35
+
latestMessagePreview?: string|JSX.Element;
34
36
/** Status describing whether own message has been delivered or read by another. If the last message is not an own message, then the status is undefined. */
35
37
messageDeliveryStatus?: MessageDeliveryStatus;
36
38
/** Number of unread Messages */
@@ -50,6 +52,12 @@ export type ChannelPreviewProps<
50
52
channelUpdateCount?: number;
51
53
/** Custom class for the channel preview root */
52
54
className?: string;
55
+
/** Custom function that generates the message preview in ChannelPreview component */
0 commit comments