Group Channel list
A channel list shows a complete list of group channels that the current user is a member of by using the GroupChannelList
module. Once the client app is connected to the Sendbird server, you can display the channel list. All chat services built with Sendbird UIKit begin from the channel list. Note that it can only list channels that the current user is a member of and can't list other public channels the user hasn't joined.
Usage
To start using the GroupChannelList
module, implement the following code:
List of properties
The following table lists the properties of the GroupChannelList
module.
Required | Type | Description |
---|---|---|
onChannelSelect | function | Specifies the prop to receive callback when selecting a channel in the channel list. |
onCreateChannel | function | Specifies the prop to receive callback when a channel is created. |
Optional | Type | Description |
---|---|---|
selectedChannelUrl | string | Specifies the URL of the currently selected channel within the channel list. |
channelListQueryParams | object | Specifies a GroupChannelCollectionParams and GroupChannelFilter to filter channels in the channel list. |
onUpdatedUserProfile | function | Specifies the prop to receive callback when a user profile has been successfully edited. (Default: |
className | string | Specifies the CSS custom name of the class. (Default: |
isTypingIndicatorEnabled | boolean | Determines whether the typing indicator appears on the channel list view. (Default: |
isMessageReceiptStatusEnabled | boolean | Determines whether the message receipt status appears on the channel list view. The possible message receipt statuses are |
disableAutoSelect | boolean | Determines whether the first channel in the channel list view is automatically selected. (Default: |
onBeforeCreateChannel | function | Specifies the prop to execute custom operations before creating a channel. (Default: |
onThemeChange | function | Specifies the prop to receive callback when the theme has changed between |
renderUserProfile | ReactElement | Renders a customized user profile preview dialog when selecting the profile avatar. The following are given as arguments: |
renderHeader | ReactElement | Renders a customized header component to replace the default header. The following are given as arguments: |
renderPlaceHolderError | ReactElement | Renders a customized placeholder for an error status in the channel list. (Default: |
renderPlaceHolderLoading | ReactElement | Renders a customized placeholder for a loading status in the channel list. (Default: |
renderPlaceHolderEmptyList | ReactElement | Renders a customized placeholder for an empty list status when the channel list is empty. (Default: |
renderChannelPreview | ReactElement | Renders a customized channel preview component to replace the default |
allowProfileEdit | boolean | Determines whether to allow the user to edit their profile. (Default: |
Context
To store and handle data that are used to build a working channel list, Sendbird UIKit provides two context objects: GroupChannelListProvider
and useGroupChannelListContext
hook. GroupChannelListProvider
is a provider that manages all the logic and data used in the channel list view. The useGroupChannelListContext
is a context hook that allows access to the provider's data.
GroupChannelListProvider
GroupChannelListProvider
contains input props and internal data that handle all the operations in the module. The provider stores data from Chat SDK in real-time and exports them to the UI components. The following code shows how to start using GroupChannelListProvider
.
List of properties
The following table lists the properties of GroupChannelListProvider
.
Required | Type | Description |
---|---|---|
onChannelSelect | function | Specifies the prop to receive callback when selecting a channel in the channel list. |
onCreateChannel | function | Specifies the prop to receive callback when a channel is created. |
Optional | Type | Description |
---|---|---|
channelListQueryParams | object | Specifies a GroupChannelCollectionParams and GroupChannelFilter to filter channels in the channel list. |
onUpdatedUserProfile | function | Specifies the prop to receive callback when a user profile has been successfully edited. (Default: |
className | string | Specifies the CSS custom name of the class. (Default: |
onBeforeCreateChannel | function | Specifies the prop to execute custom operations before creating a channel. (Default: |
onThemeChange | function | Specifies the prop to receive callback when the theme has changed between |
allowProfileEdit | boolean | Determines whether to allow the user to edit their profile. (Default: |
renderUserProfile | ReactElement | Renders a customized user profile preview dialog when selecting the user avatar. The following are given as arguments: |
disableUserProfile | boolean | Determines whether to display the user profile preview dialog when selecting the user avatar. If set to |
useGroupChannelListContext
The useGroupChannelListContext
context hook exports the data in the provider to the UI components to create a functional view of the channel list. Every UI component of any layer or level can get access to the data using the context hooks as long as they're inside the provider.
The following code shows how to start using useGroupChannelListContext
.
List of properties
The following table lists the properties of useGroupChannelListContext
.
Property name | Type | Description |
---|---|---|
initialized | boolean | Determines whether the channel list is initialized. |
groupChannels | array of objects | Specifies a list of channels that are loaded in the list. |
loadMore | function | Loads more channels in the list. |
refresh | function | Refreshes the list of channels. |
refreshing | boolean | Determines whether the channel list is refreshing. |
UI components
The UI components in the GroupChannelList
module are the following: GroupChannelListUI
, GroupChannelListHeader
, and GroupChannelListItem
. They're the default set of UI components that compose the channel list view.
GroupChannelListUI
GroupChannelListUI
is the component that displays the basic screen of the module. It contains placeholders for error and loading statuses and renders the header and channel preview. The following code shows how to implement GroupChannelListUI
.
List of properties
The following table lists the properties of GroupChannelListUI
.
Property name | Type | Description |
---|---|---|
renderHeader | ReactElement | Renders a customized header component to replace the default header. The following are given as arguments: |
renderPlaceHolderError | ReactElement | Renders a customized placeholder for an error status in the channel list. (Default: |
renderPlaceHolderLoading | ReactElement | Renders a customized placeholder for a loading status in the channel list. (Default: |
renderPlaceHolderEmptyList | ReactElement | Renders a customized placeholder for an empty list status when the channel list is empty. (Default: |
renderChannelPreview | ReactElement | Renders a customized channel preview component to replace the default |
GroupChannelListHeader
GroupChannelListHeader
is the header component of the GroupChannelListUI
that displays the title and a button to create a new channel.
The following code shows how to implement GroupChannelListHeader
.
List of properties
Property name | Type | Description |
---|---|---|
renderHeader | ReactElement | Renders a customized header to replace the default header. The following are given as arguments: |
renderIconButton | ReactElement | Renders a customized icon button to create a new group channel. (Default: |
allowProfileEdit | boolean | Determines whether to allow the user to edit their profile. (Default: |
GroupChannelListItem
GroupChannelListItem
is a component that displays a single channel in the list item UI. You can customize this component using renderChannelPreview
.
The following code shows how to implement GroupChannelListItem
.
List of properties
Property name | Type | Description |
---|---|---|
channel | instance | Specifies the channel instance shown in the list item. (Default: |
onClick | function | Specifies the prop to select a channel item in the list. (Default: |
renderChannelAction | ReactElement | Renders a customized action on the channel list item when selected. (Default: |
isSelected | boolean | Determines whether the channel displayed in the list item UI is currently active. (Default: |