Messages in a group channel
A group channel allows close interactions between a limited number of users. Users can create 1-to-1 group channels or 1-to-N group channels and an invitation from a channel member is required by default to join the channel.
ChannelScreen composable
The ChannelScreen
composable is a screen that displays messages exchanged among channel members. It is a pre-built screen that provides a list of channels with a top bar, loading screen, failure screen, and empty screen.
Parameters
The ChannelScreen
composable provides a convenient API for creating a chat in a group channel screen. ChannelScreen
has specific parameters for handling particular elements of the screen. Among them are the following:
Parameter | Description |
---|---|
navController | A navigation controller that manages the Sendbird navigation flow. |
channelUrl | A channel URL that is used to retrieve a group channel. |
modifier | A modifier that is applied to the composable. |
onTopBarNavigationIconClick | The function called when the user clicks the navigation icon. |
onTopBarActionClick | The function called when the user clicks the action icon. |
onMessageItemClick | The function called when the user clicks a message item. |
onMessageItemLongClick | The function called when the user long-clicks a message item. |
onChannelRemoved | The function called when the channel is removed. |
messageInputState | A state that indicates the text in the message input field. |
dialogState | A state that indicates whether the dialog is shown. |
imageViewerState | A state that indicates whether the image viewer is shown. |
snackbarHostState | A state that indicates whether the snackbar is shown. |
viewModelContract | A view model that provides the chat in a group channel screen UI state. |
topBar | A composable that serves as the top bar. |
loading | A composable that serves as the loading screen before the chat is loaded. |
failure | A composable that serves as the failure screen when the chat fails to load. |
empty | A composable that serves as the empty screen when messages are empty. |
messageMenuDialog | A composable that serves as the message menu dialog. |
messageInputBottomSheet | A composable that serves as the message input bottom sheet. |
messageItem | A composable that serves as the message item. |
messageInput | A composable that serves as the message input field. |
Composition tree
ChannelScreen
is composed of the following components:
How to render
The following example demonstrates how to render and customize the ChannelScreen
composable with the default UI components.
Basic usage
The following example implements the default ChannelScreen
composable with navigation:
Note: To learn how to integrate Sendbird navigation, see Navigation.
Customization
The following is a customization example of the ChannelScreen
composable. In this case:
- the navigation icon of the top bar is invisible.
- the new message item is shown with the text "New".