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.
User
or Group
Object.onThreadRepliesClick
is triggered when you click on the threaded message bubble. The onThreadRepliesClick
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 |
---|---|
ccOpenChat | 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 three states such as: inProgress, success and error |
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. |
ccLiveReaction | Triggers whenever a loggedIn clicks on live reaction |
CometChatMessageEvents
Listener’s
CometChatMessageEvents
Listener’s
Property | Description | Code |
---|---|---|
border | Used to set border | border?: string, |
borderRadius | Used to set border radius | borderRadius?: string; |
background | Used to set background colour | background?: string; |
height | Used to set height | height?: string; |
width | Used to set width | width?: string; |
loadingIconTint | used to set loading icon tint | loadingIconTint?: string; |
emptyStateTextFont | used to set empty state text font | emptyStateTextFont?: string; |
errorStateTextFont | used to set error state text font | errorStateTextFont?: string; |
emptyStateTextColor | used to set empty state text color | emptyStateTextColor?: string; |
errorStateTextColor | used to set error state text color | errorStateTextColor?: string; |
nameTextColor | used to set sender/receiver name text color on a message bubble. | nameTextColor?: string; |
nameTextFont | used to set sender/receiver name text font on a message bubble | nameTextFont?: string; |
TimestampTextColor | used to set time stamp text color | TimestampTextColor?: string; |
TimestampTextFont | used to set time stamp text font | TimestampTextFont?: string; |
threadReplyTextColor | used to set thread reply text color | threadReplyTextColor?: string; |
threadReplyTextFont | used to set thread reply text font | threadReplyTextFont?: string; |
threadReplyIconTint | used to set thread reply icon tint | threadReplyIconTint?: string; |
threadReplyUnreadTextColor | used to set thread reply unread text color | threadReplyUnreadTextColor?: string; |
threadReplyUnreadTextFont | used to set thread reply unread text font | threadReplyUnreadTextFont?: string; |
threadReplyUnreadBackground | used to set thread reply unread background | threadReplyUnreadBackground?: string; |
Avatar
component in the Message List
Component, you can use the following code snippet. For further insights on Avatar
Styles refer
DateSeparator
in the Message list
Component, you can use the following code snippet.
EmojiKeyBoard
in the Message list
Component, you can use the following code snippet.
Property | Description | Code |
---|---|---|
user report | Used to pass user object of which header specific details will be shown | user={chatUser} |
group report | 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 left or standard | {MessageListAlignment.left} |
emptyStateText | used to set text which will be visible when no messages are available | emptyStateText="Your Custom Empty State text" |
errorStateText | used to set text which will be visible when error in messages retrieval | errorStateText="Your Custom Error State text" |
hideError | used to toggle visibility of error in MessageList | hideError={true} |
disableSoundForMessages report | used to enable/disable sound for incoming/outgoing messages , default false | disableSoundForMessages={true} |
customSoundForMessages report | used to set custom sound for outgoing message | customSoundForMessages="your custom sound for messages" |
readIcon | used to set custom read icon visible at read receipt | readIcon="your custom read icon" |
deliveredIcon | used to set custom delivered icon visible at read receipt | deliveredIcon="your custom delivered icon" |
sentIcon | used to set custom sent icon visible at read receipt | sentIcon="your custom sent icon " |
waitIcon | used to set custom wait icon visible at read receipt | waitIcon="your custom wait icon" |
showAvatar | used to toggle visibility for avatar | showAvatar={true} |
hideDateSeparator | used to toggle visibility of date separator | hideDateSeparator={true} |
timestampAlignment | used to set receipt’s time stamp alignment .It can be either top or bottom | timestampAlignment={TimestampAlignment.top} |
newMessageIndicatorText report | used to set new message indicator text | newMessageIndicatorText="Custom Indicator text" |
scrollToBottomOnNewMessage | should scroll to bottom on new message? , by default false | scrollToBottomOnNewMessages={true} |
hideReceipt | Used to control the visibility of read receipts without affecting the functionality of marking messages as read and delivered. | hideReceipt={true} |
Disable Mentions | Sets whether mentions in text should be disabled. Processes the text formatters If there are text formatters available and the disableMentions flag is set to true, it removes any formatters that are instances of CometChatMentionsFormatter. | disableMentions={true} |
Disable Reactions | Sets A boolean value indicating whether to disable reactions.Pass true to disable reactions, false to enable them. | disableReactions={true} |
DateSeparatorPattern
prop. Choose from predefined options like time, DayDate, DayDateTime, or DateTime.
Name | Description |
---|---|
time | Date format displayed in the format hh:mm a |
DayDate | Date format displayed in the following format. 1) If timestamp < 24hrs display “Today” 2) If timestamp < 48hrs display “Yesterday” 3) If timestamp < 7days display “EEE” i.e , SUNDAY 4) else display “d MMM, yyyy” |
DayDateTime | Date format displayed in the following format. 1) If timestamp < 24hrs display “hh:mm a” 2) If timestamp < 48hrs display “Yesterday” 3) If timestamp < 7days display “EEE” i.e SUNDAY 4) else display “dd MM yyyy” |
errorStateView
to match the error view of your app.
emptyStateView
method provides the ability to set a custom empty state view in your app. An empty state view is displayed when there are no messages for a particular user.
loadingStateView
property allows you to set a custom loading view in your app. This feature enables you to maintain a consistent look and feel throughout your application,
MessageInformationConfiguration
object.
MessageInformationConfiguration
indeed provides access to all the Action, Filters, Styles, Functionality, and Advanced properties of the MesssageInformation component.
Please note that the properties marked with the report symbol are not accessible within the Configuration Object.
Example
Default
MessageInformationConfiguration
.
reactionsConfiguration
object.