Overview
The Conversations is a Component, That shows all conversations for the currently logged-in user,- iOS
- Android

Usage
Integration
To use Conversations in your component, use the following code snippet:App.tsx
Actions
Actions dictate how a component functions. They are divided into two types: Predefined and User-defined. You can override either type, allowing you to tailor the behavior of the component to fit your specific needs.1. onItemPress
OnItemPress is triggered when you press on a ListItem of the Conversations component. The OnItemPress action doesn’t have a predefined behavior. You can override this action using the following code snippet.
- App.tsx
2. onItemLongPress
onItemLongPress is triggered when you long press on a ListItem of the Conversations component. The onItemLongPress action doesn’t have a predefined behavior. You can override this action using the following code snippet.
- App.tsx
3. onSelection
TheonSelection event is triggered upon the completion of a selection in SelectionMode. It does not have a default behavior. However, you can override its behavior using the following code snippet.
- App.tsx
4. onBack
onBack is triggered when you press the back button in the app bar. It does not have a default behavior. However, you can override its behavior using the following code snippet.
- App.tsx
5. OnError
This action doesn’t change the behavior of the component but rather listens for any errors that occur in the Conversations component.- App.tsx
Filters
You can setConversationsRequestBuilder in the Conversations Component to filter the conversation list. You can modify the builder as per your specific requirements with multiple options available to know more refer to ConversationRequestBuilder.
You can set filters using the following parameters.
- Conversation Type: Filters on type of Conversation,
UserorGroups - Limit: Number of conversations fetched in a single request.
- WithTags: Filter on fetching conversations containing tags
- Tags: Filters on specific
Tag - UserTags: Filters on specific User
Tag - GroupTags: Filters on specific Group
Tag
- App.tsx
Events
Events are emitted by aComponent. 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.
- Add Listener
- Remove Listener
Customization
To fit your app’s design requirements, you can customize the appearance of the conversation component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.Style
Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.1. Conversations Style
You can set theConversationsStyle to the Conversations Component to customize the styling.
- App.tsx
| Name | Type | Description |
|---|---|---|
| backgroundColor | string | Sets the background colour for Conversations |
| height | number | string | Sets the height for Conversations |
| borderRadius | number | Sets the border radius for Conversations |
| width | number | string | Sets the width for Conversations |
| border | BorderStyleInterface | Sets the border colour for Conversations |
| titleColor | string | Sets the title colour for Conversations |
| titleFont | FontStyleInterface | Sets the title font for Conversations |
| backIconTint | string | Sets the back button tint colour for Conversations |
| onlineStatusColor | string | Sets the online status colour for Conversations |
| separatorColor | string | Sets the separator colour for Conversations |
| loadingIconTint | string | Sets the loading icon colour for Conversations |
| emptyTextColor | string | Sets the empty text colour for Conversations |
| emptyTextFont | FontStyle | Sets the empty text font for Conversations |
| errorTextColor | string | Sets the error text colour for Conversations |
| errorTextFont | FontStyle | Sets the error text font for Conversations |
| lastMessageTextColor | string | Sets the last message text text colour |
| lastMessageTextFont | FontStyle | Sets the last message text font for Conversations |
| typingIndictorTextColor | string | Sets the typing indicator colour for Conversations |
| typingIndictorTextFont | FontStyle | Sets the typing indicator font for Conversations |
| threadIndicatorTextFont | FontStyle | Sets the thread indicator text font for Conversations |
| threadIndicatorTextColor | string | Sets the thread indicator text font for Conversations |
2. Avatar Style
To apply customized styles to theAvatar component in the Conversations Component, you can use the following code snippet. For further insights on Avatar Styles refer
- App.tsx
3. StatusIndicator Style
To apply customized styles to the Status Indicator component in theConversations Component, you can use the following code snippet. For further insights on Status Indicator Styles refer
- App.tsx
4. Date Style
To apply customized styles to theDate component in the Conversations Component, you can use the following code snippet. For further insights on Date Styles refer
- App.tsx
5. Badge Style
To apply customized styles to theBadge component in the Conversations Component, you can use the following code snippet. For further insights on Badge Styles refer
- App.tsx
6. Confirm Dialog Style
To apply customized styles to thedelete dialog component in the Conversations Component, you can use the following code snippet.
- App.tsx
6. List Item Style
To apply customized styles to theListItemStyle component in the Conversations Component, you can use the following code snippet. For further insights on ListItemStyle Styles refer
- App.tsx
Functionality
These are a set of small functional customizations that allow you to fine-tune the overall experience of the component. With these, you can change text, set custom icons, and toggle the visibility of UI elements.- App.tsx
| Property | Description | Code |
|---|---|---|
| Title | Used to set custom title in the app bar. | title="Your Custom Title" |
| EmptyState Text | Used to set a custom text response when fetching the conversations has returned an empty list | emptyStateText="Your Custom Empty State text" |
| Selection Mode | Used to set a custom text response when fetching the conversations has returned an empty list | selectionMode={SelectionMode.multiple} |
| ProtectedGroup Icon | Used to set icon shown in place of status indicator for password protected group | protectedGroupIcon={{uri: <image url>}} OR import customProtectedGroupIcon from "./customProtectedGroupIcon.svg"; ``protectedGroupIcon={customProtectedGroupIcon} |
| privateGroupIcon | Used to set icon shown in place of status indicator for private group | privateGroupIcon={{uri: <image url>}} OR import customPrivateGroupIcon from "./customPrivateGroupIcon.svg"; privateGroupIcon={customPrivateGroupIcon} |
| SentIcon | Used to customize the receipt icon shown in the subtitle of the conversation item if hideReceipt is false and if the status of the last message in the conversation is sent | sentIcon={{uri: <image url>}} OR import customSentIcon from "./secustomSentIconntIcon.svg"; sentIcon={customSentIcon} |
| Delivered Icon | Used to customize the receipt icon shown in the subtitle of the conversation item if hideReceipt is false and if the status of the last message in the conversation is delivered | deliveredIcon={{uri: <image url>}} OR import customDeliveredIcon from "./customDeliveredIcon.svg"; ``deliveredIcon={customDeliveredIcon} |
| Read Icon | Used to customize the receipt icon shown in the subtitle of the conversation item if hideReceipt is false and if the status of the last message in the conversation is read | readIcon={{uri: <image url>}} OR import customReadIcon from "./customReadIcon.svg"; readIcon={customReadIcon} |
| errorIcon | Asset URL for the error state indicating that an error has occurred when the message was in transit. | errorIcon={{uri: <image url>}} OR import customErrorIcon from "./customErrorIcon.svg"; errorIcon={customErrorIcon} |
| Hide Error | Used to hide error on fetching conversations | hideError={true} |
| Hide Separator | Used to control visibility of Separators in the list view | hideSeparator={true} |
| Disable UsersPresence | Used to control visibility of status indicator shown if user is online | disableUsersPresence={true} |
| Hide Receipt | Used to control the visibility of read receipts without affecting the functionality of marking messages as read and delivered | hideReceipt={false} |
| Disable Typing | Used to toggle visibility of typing indicator | disableTyping={true} |
| disableSoundForMessages | When set to true, the component will not produce sound for all incoming messages.indicator | disableSoundForMessages={true} |
| customSoundForMessages | mp3 file asset of your choice. | import customMessageSound from "./customMessageSound.wav"; customSoundForMessages={customMessageSound} |
| disableMentions | 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} |
Advanced
For advanced-level customization, you can set custom views to the component. This lets you tailor each aspect of the component to fit your exact needs and application aesthetics. You can create and define your views, layouts, and UI elements and then incorporate those into the component.ListItemView
With this function, you can assign a custom ListItem to the Conversations Component.- TypeScript
- iOS
- Android

getListItemView function as follows:
- TypeScript
TextFormatters
Assigns the list of text formatters. If the provided list is not null, it sets the list. Otherwise, it assigns the default text formatters retrieved from the data source. To configure the existing Mentions look and feel check out CometChatMentionsFormatter- ShortCutFormatter.ts
- App.tsx
AppBarOptions
You can set the Custom AppBar Options to add more options to the Conversations component.- TypeScript
- iOS
- Android

getAppBarOptions function as follows:
- TypeScript
DatePattern
You can modify the date pattern to your requirement using DatePattern. datePattern formats date and time values according to a predefined standard, enhancing consistency and clarity in their presentation.- App.tsx
- iOS
- Android

Subtitle View
You can customize the subtitle view for each conversation item to meet your requirements- App.tsx
- iOS
- Android

getSubtitleView function as follows:
- App.tsx
Swipe Options
This prop will add the array of options on swipe to perform actions on Conversation.| Name | Type | Description |
|---|---|---|
| options? | (item: CometChat.Conversation) => CometChatOptions[] | This prop will add the array of options on swipe to perform actions on Conversation. |
Structure of CometChatOptions
| Name | Type | Description |
|---|---|---|
| id | String | Unique identifier for the option |
| title | String | A text to display below the icon |
| icon | ImageType | A image to display for the option |
| titleStyle | CometChatOptionTitleStyle | Defines the style for the title containing color, fontWeight, fontSize, fontFamily properties |
| iconTint | string | Defines the colour for the icon |
| backgroundColor | string | Defines the colour for the option |
| onPress | Function | The action to perform when user clicks on option |
- iOS
- Android

- TypeScript
Loading State View
You can set a custom loader view usingLoadingStateView to match the loading view of your app.
- TypeScript
- iOS
- Android

getLoadingStateView function as follows:
- App.tsx