MessageList
is a Composite Component that displays a list of messages and effectively manages real-time operations. It includes various types of messages such as Text Messages, Media Messages, Stickers, and more.
MessageList
is primarily a list of the base component MessageBubble. The MessageBubble Component is utilized to create different types of chat bubbles depending on the message type.
CometChatMessageList
component into your app.
CometChatMessageList
component to the layout will result in an error. To fetch messages, you need to supplement it with user
or group
prop.onThreadRepliesPress
is triggered when you press on the threaded message bubble. The onThreadRepliesPress
action doesn’t have a predefined behavior. You can override this action using the following code snippet.
MessagesRequestBuilder
in the MessageList Component to customize your message list. Numerous options are available to alter the builder to meet your specific needs. For additional details on MessagesRequestBuilder
, please visit MessagesRequestBuilder.
In the example below, we are applying a filter to the messages based on a search substring and for a specific user. This means that only messages that contain the search term and are associated with the specified user will be displayed
Component
. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.
The list of events emitted by the Message List component is as follows.
Event | Description |
---|---|
openChat | this event alerts the listeners if the logged-in user has opened a user or a group chat |
ccMessageEdited | Triggers whenever a loggedIn user edits any message from the list of messages. It will have two states such as: inProgress & sent |
ccMessageDeleted | Triggers whenever a loggedIn user deletes any message from the list of messages |
ccActiveChatChanged | This event is triggered when the user navigates to a particular chat window. |
ccMessageRead | Triggers whenever a loggedIn user reads any message. |
ccMessageDelivered | Triggers whenever messages are marked as delivered for the loggedIn user |
CometChatMessageEvents
Listener’s
Property | Description | Code |
---|---|---|
user | Used to pass user object of which header specific details will be shown | user={chatUser} |
group | Used to pass group object of which header specific details will be shown | group={chatGroup} |
alignment | used to set the alignmet of messages in CometChatMessageList. It can be either leftAligned or standard. Type: MessageListAlignmentType | alignment={"standard"} |
disableSoundForMessages | used to enable/disable sound for incoming/outgoing messages , default false | disableSoundForMessages={true} |
customSoundForMessages | used to set custom sound for outgoing message | customSoundForMessages="your custom sound for messages" |
avatarVisibility | used to toggle visibility for avatar | avatarVisibility={true} |
scrollToBottomOnNewMessage | should scroll to bottom on new message? , by default false | scrollToBottomOnNewMessages={true} |
receiptsVisibility | Used to control the visibility of read receipts without affecting the functionality of marking messages as read and delivered. | receiptsVisibility={true} |
hideError | used to toggle visibility of error state in MessageList | hideError={true} |
quickReactionList | The list of quick reactions to be set.This list will replace the predefined set of reactions | quickReactionList=["👻","😈","🙀","🤡","❤️"]; |
hideReplyInThreadOption | used to toggle visibility of Reply in thread option in MessageList | hideReplyInThreadOption={true} |
hideShareMessageOption | used to toggle visibility of share message option in MessageList | hideShareMessageOption={true} |
hideEditMessageOption | used to toggle visibility of hide edit message option in MessageList | hideEditMessageOption={true} |
hideTranslateMessageOption | used to toggle visibility of translate message option in MessageList | hideTranslateMessageOption={true} |
hideDeleteMessageOption | used to toggle visibility of Delete message option in MessageList | hideDeleteMessageOption={true} |
hideMessagePrivatelyOption | used to toggle visibility of hide message privately option in MessageList | hideMessagePrivatelyOption={true} |
hideCopyMessageOption | used to toggle visibility of hide copy message option in MessageList | hideCopyMessageOption={true} |
hideMessageInfoOption | used to toggle visibility of hide message info option in MessageList | hideMessageInfoOption={true} |
hideGroupActionMessages | used to toggle visibility of hide group action info option in MessageList | hideGroupActionMessages={true} |
hideTimestamp | used to toggle visibility of hide timestamp in MessageList | hideTimestamp={true} |