Skip to main content

Overview

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

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.

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.

3. onSelection
The onSelection 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.

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.

5. OnError
This action doesn’t change the behavior of the component but rather listens for any errors that occur in the Conversations component.


Filters

You can set ConversationsRequestBuilder 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.
  1. Conversation Type: Filters on type of Conversation, User or Groups
  2. Limit: Number of conversations fetched in a single request.
  3. WithTags: Filter on fetching conversations containing tags
  4. Tags: Filters on specific Tag
  5. UserTags: Filters on specific User Tag
  6. GroupTags: Filters on specific Group Tag

Events

Events are emitted by a 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.

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 the ConversationsStyle to the Conversations Component to customize the styling.
List of properties exposed by ConversationsStyle
2. Avatar Style
To apply customized styles to the Avatar component in the Conversations Component, you can use the following code snippet. For further insights on Avatar Styles refer
3. StatusIndicator Style
To apply customized styles to the Status Indicator component in the Conversations Component, you can use the following code snippet. For further insights on Status Indicator Styles refer
4. Date Style
To apply customized styles to the Date component in the Conversations Component, you can use the following code snippet. For further insights on Date Styles refer
5. Badge Style
To apply customized styles to the Badge component in the Conversations Component, you can use the following code snippet. For further insights on Badge Styles refer
6. Confirm Dialog Style
To apply customized styles to the delete dialog component in the Conversations Component, you can use the following code snippet.
6. List Item Style
To apply customized styles to the ListItemStyle component in the Conversations Component, you can use the following code snippet. For further insights on ListItemStyle Styles refer

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.
Below is a list of customizations along with corresponding code snippets

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.
Demonstration
Image
You can customize the appearance of each list item by modifying the getListItemView function as follows:

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

AppBarOptions

You can set the Custom AppBar Options to add more options to the Conversations component.
Demonstration
Image
You can customize the menu by modifying the getAppBarOptions function as follows:

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.
Demonstration
Image

Subtitle View

You can customize the subtitle view for each conversation item to meet your requirements
Demonstration
Image
You can customize the subtitle view by modifying the getSubtitleView function as follows:

Swipe Options

This prop will add the array of options on swipe to perform actions on Conversation.
Structure of CometChatOptions
Demonstration
Image

Loading State View

You can set a custom loader view using LoadingStateView to match the loading view of your app.
Demonstration
Image
You can customize the loading state view by modifying the getLoadingStateView function as follows: