fun MessageItem(messageItem: MessageItemState, reactionSorting: ReactionSorting, onLongItemClick: (Message) -> Unit, modifier: Modifier = Modifier, messageContentFactory: MessageContentFactory = ChatTheme.messageContentFactory, 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,
messageContentFactory = messageContentFactory,
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, messageContentFactory = messageContentFactory)
}, 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
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.
The sorting for the reactions, if we have any.
Handler when the user selects a message, on long tap.
Handler when the user taps on message reactions.
Handler for thread clicks, if this message has a thread going.
Handler for casting a vote on an option.
Handler for removing a vote on an option.
Handler for selecting a poll.
Handler for adding an answer to a poll.
Handler for closing a poll.
Handler for adding a poll option.
Handler when the user taps on an action button in a giphy message item.
Handler for quoted message click action.
Handler when users avatar is clicked.
Handler for clicking on a link in the message.
onMediaGalleryPreviewResult
Handler when the user selects an option in the Media Gallery Preview screen.
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.
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.
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.
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.
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.