ConversationListProvider
acts as the wrapper for the entire ConversationList
, providing context to all components within the ConversationList
.ConversationListProvider
internally listens to and processes data related to Conversation
in the ChatEngine
, then passes it to the entire ConversationList UI
.ConversationListProvider
accepts two optional parameters: filter
and sort
, to handle the conversationList
data to be displayedParameter Name | Type | Default Value | Indication |
filter | - | Function for Filtering Conversation List. | |
sort | - | Function for Sorting Conversation List. |
import { ConversationListProvider, IConversationListProps } from '@tencentcloud/chat-uikit-react';function CustomConversationList(props: IConversationListProps) {<ConversationListProvider filter={props.filter} sort={props.sort}><div>Custom ConversationList UI</div></ConversationListProvider>;}
ConversationListProvider
can read and subscribe to values in the useConversationList
context
.useConversationList
provides the following context values:Parameter Name | Type | Indication |
conversationList | The original conversation list obtained from ChatEngine. | |
filteredAndSortedConversationList | The conversation list to be rendered by ConversationList. This is the conversation list filtered and sorted by ConversationListProvider. | |
currentConversation | The currently open conversation. | |
setCurrentConversation | Set the currently open conversation. | |
isLoading | Boolean | Determine whether the current conversation list is loading. |
isLoadError | Boolean | Determine whether there been an error fetching the current conversation list. |
import {useConversationList
} from '@tencentcloud/chat-uikit-react';const {conversationList,filteredAndSortedConversationList,currentConversation,setCurrentConversation} =useConversationList
();
Was this page helpful?