MessageItem

fun MessageItem(messageItem: MessageItemState, reactionSorting: ReactionSorting, onLongItemClick: (Message) -> Unit, modifier: Modifier = Modifier, onReactionsClick: (Message) -> Unit = {}, onThreadClick: (Message) -> Unit = {}, onPollUpdated: (Message, Poll) -> Unit = { _, _ -> }, onCastVote: (Message, Poll, Option) -> Unit = { _, _, _ -> }, onRemoveVote: (Message, Poll, Vote) -> Unit = { _, _, _ -> }, selectPoll: (Message, Poll, PollSelectionType) -> Unit = { _, _, _ -> }, onAddAnswer: (message: Message, poll: Poll, answer: String) -> Unit = { _, _, _ -> }, onClosePoll: (String) -> Unit = {}, onAddPollOption: (poll: Poll, option: String) -> Unit = { _, _ -> }, onGiphyActionClick: (GiphyAction) -> Unit = {}, onQuotedMessageClick: (Message) -> Unit = {}, onUserAvatarClick: () -> Unit? = null, onLinkClick: (Message, String) -> Unit? = null, onUserMentionClick: (User) -> Unit = {}, onMediaGalleryPreviewResult: (MediaGalleryPreviewResult?) -> Unit = {}, leadingContent: @Composable RowScope.(MessageItemState) -> Unit = { DefaultMessageItemLeadingContent( messageItem = it, onUserAvatarClick = onUserAvatarClick, ) }, headerContent: @Composable ColumnScope.(MessageItemState) -> Unit = { DefaultMessageItemHeaderContent( messageItem = it, reactionSorting = reactionSorting, onReactionsClick = onReactionsClick, ) }, centerContent: @Composable ColumnScope.(MessageItemState) -> Unit = { DefaultMessageItemCenterContent( messageItem = it, onLongItemClick = onLongItemClick, onMediaGalleryPreviewResult = onMediaGalleryPreviewResult, onGiphyActionClick = onGiphyActionClick, onQuotedMessageClick = onQuotedMessageClick, onLinkClick = onLinkClick, onUserMentionClick = onUserMentionClick, onPollUpdated = onPollUpdated, onCastVote = onCastVote, onRemoveVote = onRemoveVote, selectPoll = selectPoll, onAddAnswer = onAddAnswer, onClosePoll = onClosePoll, onAddPollOption = onAddPollOption, ) }, 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.

reactionSorting

The sorting for the reactions, if we have any.

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.

onCastVote

Handler for casting a vote on an option.

onRemoveVote

Handler for removing a vote on an option.

selectPoll

Handler for selecting a poll.

onAddAnswer

Handler for adding an answer to a poll.

onClosePoll

Handler for closing a poll.

onAddPollOption

Handler for adding a poll option.

onGiphyActionClick

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

onQuotedMessageClick

Handler for quoted message click action.

onUserAvatarClick

Handler when users avatar is clicked.

onLinkClick

Handler for clicking on a link in the message.

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.