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.
error view
and improve error handling. You have the option to integrate your own custom UIView
file for this purpose.
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.
uid
and name
of the User in the implementation.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 MessageList Component does not emit any events of its own.
Property | Description | Code |
---|---|---|
Border Width | used to set border width | .set(borderWidth: CGFloat) |
Border Color | used to set border color | .set(titleColor: UIColor) |
Corner Radius | used to set corner radius | .set(cornerRadius: CometChatCornerStyle) |
LoadingIcon Tint | used to set loading icon tint | .set(loadingIconTint: UIColor) |
EmptyText Appearance | used to set empty state text Appearance | .set(emptyTextFont: UIFont) |
ErrorText Appearance | used to set error text Appearance | .set(errorTextFont: UIFont) |
EmptyText Color | used to set empty state text color | .set(emptyTextColor: UIColor) |
ErrorText Color | used to set error state text color | .set(errorTextColor: UIColor) |
NameText Color | used to set sender/receiver name text color on a message bubble. | .set(nameTextColor: UIColor) |
NameText Appearance | used to set sender/receiver name text appearance on a message bubble | .set(nameTextFont: UIFont) |
TimeStampText Color | used to set time stamp text appearance | .set(timestampTextColor: UIColor) |
ThreadReplySeparator Color | used to set thread reply separator color | .set(threadReplySeperatorColor: UIColor) |
ThreadReplyText Color | used to set thread reply text color | .set(threadReplyTextColor: UIColor) |
ThreadReplyText Appearance | used to set thread reply text appearance | .set(threadReplyTextFont: UIFont) |
Background | This method will set the background color for message list | .set(background: UIColor) |
Avatar
component in the Conversations
Component, you can use the following code snippet. For further insights on Avatar
Styles refer
Property | Description | Code |
---|---|---|
User | Used to pass user object of which header specific details will be shown | .set(user: User) |
Group | Used to pass group object of which header specific details will be shown | .set(group: Group) |
Messages Alignment | used to set the alignmet of messages in CometChatMessageList. It can be either leftAligned or standard | .set(alignment: MessageListAlignment) |
EmptyState Text | used to set text which will be visible when no messages are available | .set(emptyStateMessage: String) |
ErrorState Text | used to set text which will be visible when error in messages retrieval | .set(errorMessage: String) |
Hide Error | used to toggle visibility of error in MessageList | .hide(error: Bool) |
Disable Sound For Messages | used to enable/disable sound for incoming/outgoing messages , default false | .disable(soundForMessages: Bool) |
CustomSound For Messages | used to set custom sound for outgoing message | .set(customSoundForMessages: URL) |
Set ReadIcon | used to set custom read icon visible at read receipt | .set(readIcon: UIImage) |
Set DeliverIcon | used to set custom delivered icon visible at read receipt | .set(deliveredIcon: UIImage) |
Set SentIcon | used to set custom sent icon visible at read receipt | .set(sentIcon: UIImage) |
Set WaitIcon | used to set custom wait icon visible at read receipt | .set(waitIcon: UIImage) |
Show Avatar | used to toggle visibility for avatar | .show(avatar: Bool) |
Hide Timestamp | used to toggle visibility for of timestamp | .hideTimestamp(false) |
Set TimeStampAlignment | used to set receipt’s time stamp alignment .It can be either top or bottom | .setTimeStampAlignment(UIKitConstants.TimeStampAlignment) |
Set newMessageIndicatorText | used to set new message indicator text | .set(newMessageIndicatorText: String) |
Toggle scrollToBottomOnNewMessage | should scroll to bottom on new message? , by default false | .scrollToBottomOnNewMessages(bool: Bool) |
HideReceipt | This method is used to control visibility of message receipts. | .hide(receipt: Bool) |
Add Message | This method specifies the option to add user object locally in MessageList. | add(message: BaseMessage) |
Update Message | This method specifies the option to update message object locally in MessageList. | update(message: BaseMessage) |
Remove Message | This method specifies the option to remove message object locally in MessageList. | remove(message: BaseMessage) |
Delete Message | This method specifies the option to delete message object in MessageList. This method will internally trigger SDK’s .deleteMessagefunction to delete the message from server. | delete(message: BaseMessage) |
setDateSeparatorPattern()
. This method accepts a function with a return type String. Inside the function, you can create your own pattern and return it as a String.
cometChatMessages
. If a navigation controller is already in use, utilize the pushViewController function instead of directly presenting the view controller.cometChatMessages
. If a navigation controller is already in use, utilize the pushViewController function instead of directly presenting the view controller.ErrorStateView
using setEmptyStateView
to match the error view of your app.
error_view
a UIView file. You can choose any view you prefer. This view should be passed to the .set(errorStateView: errorView)
method.
cometChatMessages
. If a navigation controller is already in use, utilize the pushViewController function instead of directly presenting the view controller.setEmptyStateView()
function 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.
Empty_View
, you can set it as the empty state view by passing it as a parameter to the setEmptyStateView() function.
cometChatMessages
. If a navigation controller is already in use, utilize the pushViewController function instead of directly presenting the view controller.cometChatMessages
. If a navigation controller is already in use, utilize the pushViewController function instead of directly presenting the view controller.MessageListConfiguration
.
cometChatMessages
. If a navigation controller is already in use, utilize the pushViewController function instead of directly presenting the view controller.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 symbol are not accessible within the Configuration Object.
Example
MessageInformationConfiguration
.
cometChatMessages
. If a navigation controller is already in use, utilize the pushViewController function instead of directly presenting the view controller.ReactionsConfiguration
object.
ReactionsConfiguration
.
cometChatMessages
. If a navigation controller is already in use, utilize the pushViewController function instead of directly presenting the view controller.