MessageItem

fun MessageItem(messageItem: MessageItemState, onLongItemClick: (Message) -> Unit, modifier: Modifier = Modifier, onReactionsClick: (Message) -> Unit = {}, onThreadClick: (Message) -> Unit = {}, onGiphyActionClick: (GiphyAction) -> Unit = {}, onQuotedMessageClick: (Message) -> Unit = {}, onMediaGalleryPreviewResult: (MediaGalleryPreviewResult?) -> Unit = {}, leadingContent: @Composable RowScope.(MessageItemState) -> Unit = { DefaultMessageItemLeadingContent(messageItem = it) }, headerContent: @Composable ColumnScope.(MessageItemState) -> Unit = { DefaultMessageItemHeaderContent( messageItem = it, onReactionsClick = onReactionsClick, ) }, centerContent: @Composable ColumnScope.(MessageItemState) -> Unit = { DefaultMessageItemCenterContent( messageItem = it, onLongItemClick = onLongItemClick, onMediaGalleryPreviewResult = onMediaGalleryPreviewResult, onGiphyActionClick = onGiphyActionClick, onQuotedMessageClick = onQuotedMessageClick, ) }, footerContent: @Composable ColumnScope.(MessageItemState) -> Unit = { DefaultMessageItemFooterContent(messageItem = it) }, trailingContent: @Composable RowScope.(MessageItemState) -> Unit = { DefaultMessageItemTrailingContent(messageItem = it) })

The default message container for all messages in the Conversation/Messages screen.

It shows the avatar and the message details, which can have a header (reactions), the content which can be a text message, file or image attachment, or a custom attachment and the footer, which can be a deleted message footer (if we own the message) or the default footer, which contains a timestamp or the thread information.

It also allows for long click and thread click events.

Parameters

messageItem

The message item to show, which holds the message and the group position, if the message is in a group of messages from the same user.

onLongItemClick

Handler when the user selects a message, on long tap.

modifier

Modifier for styling.

onReactionsClick

Handler when the user taps on message reactions.

onThreadClick

Handler for thread clicks, if this message has a thread going.

onGiphyActionClick

Handler when the user taps on an action button in a giphy message item.

onQuotedMessageClick

Handler for quoted message click action.

onMediaGalleryPreviewResult

Handler when the user selects an option in the Media Gallery Preview screen.

leadingContent

The content shown at the start of a message list item. By default, we provide DefaultMessageItemLeadingContent, which shows a user avatar if the message doesn't belong to the current user.

headerContent

The content shown at the top of a message list item. By default, we provide DefaultMessageItemHeaderContent, which shows a list of reactions for the message.

centerContent

The content shown at the center of a message list item. By default, we provide DefaultMessageItemCenterContent, which shows the message bubble with text and attachments.

footerContent

The content shown at the bottom of a message list item. By default, we provide DefaultMessageItemFooterContent, which shows the information like thread participants, upload status, etc.

trailingContent

The content shown at the end of a message list item. By default, we provide DefaultMessageItemTrailingContent, which adds an extra spacing to the end of the message list item.