CometChatMessageTemplate
is a pre-defined structure for creating message views that can be used as a starting point or blueprint for creating message views, often known as message bubbles. These views appear in the message list view and render the messages of that particular chat or conversation. It allows developers to define standard message viewing formats that can be reused or customised for different use cases, or even add new ones for their own purposes.
Name | Purpose |
---|---|
Leading view | This is where the avatar is displayed. |
Header view | This is where the name of the sender is displayed. |
Content view | This is the main view where the contents of the message, such as text, image, etc. are displayed. |
Bottom view | This is the view which can be used to extend the message with some additional element such as the link preview or a “load more” button for long messages. |
Thread view | This is specifically meant for threaded messages where the “view replies” action appears. |
Footer view | This is the designated area where any reactions added to the message are displayed. |
StatusInfo view | This is where the timestamp of the message and delivery & read status are displayed. |
Name | Type | Description |
---|---|---|
type | string | Type of the CometChat message |
category | string | Category of the CometChat message |
headerView | view | Custom component to customize the header section for each message bubble. By default, it displays the message sender’s name. |
contentView | view | Custom component to customize the content section for each message bubble. By default, it displays the Text bubble, Image bubble, File bubble, Audio bubble, and Video bubble based on the type of the message. |
footerView | view | Custom component to customize the footer section for each message bubble. By default, it displays the reactions. |
statusInfoView | view | Custom component to customize the statusInfo section for each message bubble. By default, it displays the receipt and the timestamp. |
bubbleView | view | Custom component to customize the complete message bubble. By default, headerView, contentView and footerView collectively forms a message bubble. |
options | (loggedInUser:CometChat.User | null, group:CometChat.Group | null, message: CometChat.BaseMessage) => array<CometChatActionsIcon | CometChatActionsView | List of available actions that any user can perform on a message, like reacting, editing or deleting a message. |
message
Type: text
, image
, video
, audio
, file
getAllMessageTemplates()
from DataSource.