> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-agent-in-group-react-v6.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Conversations With Messages

> Conversations With Messages — CometChat documentation.

## Overview

The ConversationsWithMessages is a [Composite Component](/ui-kit/react-native/v4/components-overview#components) encompassing components such as [Conversations](/ui-kit/react-native/v4/conversations), [Messages](/ui-kit/react-native/v4/messages), and [Contacts](/ui-kit/react-native/v4/contacts). Each of these component contributes to the functionality and structure of the overall ConversationsWithMessages component.

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/_EL7Vq6dx_iRWqWt/images/09ded458-convo_messages_overview_cometchat_screens-8b1fe910a6b1affe063449f831bd8421.png?fit=max&auto=format&n=_EL7Vq6dx_iRWqWt&q=85&s=e28dd6aeaa91c9d0a0b3fc3e8c1580d2" alt="Image" width="4335" height="3120" data-path="images/09ded458-convo_messages_overview_cometchat_screens-8b1fe910a6b1affe063449f831bd8421.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/see6b5g_JfKPgfLq/images/379ccde4-convo_messages_overview_cometchat_screens-d482f91ffdb4a6645dc701353e4da4c1.png?fit=max&auto=format&n=see6b5g_JfKPgfLq&q=85&s=cc0af80dadf0d8fa3306b3047703f2c1" alt="Image" width="4335" height="3120" data-path="images/379ccde4-convo_messages_overview_cometchat_screens-d482f91ffdb4a6645dc701353e4da4c1.png" />
  </Tab>
</Tabs>

| Components                                             | Description                                                                                                                                            |
| ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [Conversations](/ui-kit/react-native/v4/conversations) | The `Conversations` component is designed to display a list of either `User` or `Group`. This essentially represents your recent conversation history. |
| [Messages](/ui-kit/react-native/v4/messages)           | The `Messages` component is designed to manage the messaging interaction for either individual `User` or `Group` conversations.                        |
| [Contacts](/ui-kit/react-native/v4/contacts)           | The `CometChatContacts` component is specifically designed to facilitate the display and management of both `User` and `Groups`.                       |

## Usage

### Integration

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import { CometChatConversationsWithMessages } from "@cometchat/chat-uikit-react-native";

    return <CometChatConversationsWithMessages />;
    ```
  </Tab>
</Tabs>

***

### Actions

[Actions](/ui-kit/react-native/v4/components-overview#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.

While the ConversationsWithMessages component does not have its actions, its components - [Conversation](/ui-kit/react-native/v4/conversations#actions), [Messages](/ui-kit/react-native/v4/messages), and [Contacts](/ui-kit/react-native/v4/contacts) - each have their own set of actions.

The Action of the components can be overridden through the use of the [Configurations](#configurations) object of its components. Here is an example code snippet.

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import {
      CometChatConversationsWithMessages,
      ConversationsConfigurationInterface,
      ContactsConfigurationInterface,
    } from "@cometchat/chat-uikit-react-native";

    const conversationsConfiguration: ConversationsConfigurationInterface = {
      onError: (error: CometChat.CometChatException) => {
        //handle Error
      },
    };

    const contactsConfiguration: ContactsConfigurationInterface = {
      onClose: () => {
        //code
      },
    };

    return (
      <CometChatConversationsWithMessages
        conversationsConfiguration={conversationsConfiguration}
        startConversationConfiguration={contactsConfiguration}
      />
    );
    ```
  </Tab>
</Tabs>

The ConversationsWithMessages component overrides several actions from its components to reach its default behavior. The list of actions overridden by ConversationsWithMessages includes:

* [onItemPress](/ui-kit/react-native/v4/conversations#1-onitempress) : By overriding the `onItemPress` of the Conversation Component, ConversationsWithMessages achieves navigation from [Conversation](/ui-kit/react-native/v4/conversations) to [Messages](/ui-kit/react-native/v4/messages) component.

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/-4h3cKAJUX2gQz_u/images/ad5af079-itemPress_cometchat_screens-a96c8d4c95e437324a2050c1b1ec25a1.png?fit=max&auto=format&n=-4h3cKAJUX2gQz_u&q=85&s=6f3ace39de00a9535aa3b3bacbf4a138" alt="Image" width="4498" height="3120" data-path="images/ad5af079-itemPress_cometchat_screens-a96c8d4c95e437324a2050c1b1ec25a1.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/FQNeiVxajtzWdB3i/images/b9a66e9f-itemPress_cometchat_screens-cd233eb5adb797551f5f97db2bf4224c.png?fit=max&auto=format&n=FQNeiVxajtzWdB3i&q=85&s=ffc866202506fa859dcac04d683f5697" alt="Image" width="4498" height="3120" data-path="images/b9a66e9f-itemPress_cometchat_screens-cd233eb5adb797551f5f97db2bf4224c.png" />
  </Tab>
</Tabs>

### Filters

**Filters** allow you to customize the data displayed in a list within a Component. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using RequestBuilders of Chat SDK.

While the ConversationsWithMessages component does not have filters, its components do, For more detail on individual filters of its component refer to [Conversations Filters](/ui-kit/react-native/v4/conversations#filters) and [Messages Filters](/ui-kit/react-native/v4/messages).

By utilizing the [Configurations](#configurations) object of its components, you can apply filters.

In the following **example**, we're filtering Conversation to only show `User`

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import {
      CometChatConversationsWithMessages,
      ConversationsConfigurationInterface,
      ContactsConfigurationInterface,
    } from "@cometchat/chat-uikit-react-native";

    import { CometChat } from "@cometchat/chat-sdk-react-native";

    const conversationsConfiguration: ConversationsConfigurationInterface = {
      conversationsRequestBuilder: new CometChat.ConversationsRequestBuilder()
        .setConversationType("user")
        .setLimit(2),
    };

    return (
      <CometChatConversationsWithMessages
        conversationsConfiguration={conversationsConfiguration}
      />
    );
    ```
  </Tab>
</Tabs>

***

### Events

[Events](/ui-kit/react-native/v4/components-overview#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.

The ConversationsWithMessages does not generate its events but its component does. For a full list of these events, you can refer to [Conversations events](/ui-kit/react-native/v4/conversations#events) and [Messages events](/ui-kit/react-native/v4/messages#events).

In the following example, we're incorporating observers for the `ConversationDeleted` event of `Conversations` and the `MessageSent` event of the `Messages` component.

<Tabs>
  <Tab title="Add Listener">
    ```tsx theme={null}
    import { CometChatUIEventHandler } from "@cometchat/chat-uikit-react-native";

    CometChatUIEventHandler.addConversationListener("SOME_UNIQUE_ID_1", {
      ccConversationDeleted: (conversation: CometChat.Conversation) => {
        //code
      },
    });

    CometChatUIEventHandler.addMessageListener("SOME_UNIQUE_ID_2", {
      ccMessageSent: (conversation: CometChat.Conversation) => {
        //code
      },
    });

    return {
      /* your view*/
    };
    ```
  </Tab>
</Tabs>

***

## Customization

To fit your app's design requirements, you have the ability to customize the appearance of the ConversationsWithMessages 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. ConversationsWithMessages component doesn't have its own style parameters. But you can customize its component styles. For more details on individual component styles, you can refer [Conversation Styles](/ui-kit/react-native/v4/conversations#style), [Messages Styles](/ui-kit/react-native/v4/messages#style), and [Contacts Styles](/ui-kit/react-native/v4/contacts#contactstyle)

Styles can be applied to SubComponents using their respective [configurations](#configurations).

**Example**

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import {
      CometChatConversationsWithMessages,
      ConversationsConfigurationInterface,
      ConversationsStyle,
    } from "@cometchat/chat-uikit-react-native";

    const conversationsConfiguration: ConversationsConfigurationInterface = {
      conversationsStyle: {
        width: "100%",
        height: "100%",
        backgroundColor: "green",
        titleColor: "red",
      },
      listItemStyle: {
        backgroundColor: "green",
      },
    };

    return (
      <CometChatConversationsWithMessages
        conversationsConfiguration={conversationsConfiguration}
      />
    );
    ```
  </Tab>
</Tabs>

### 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.

##### User Prop

You can pass a [User](/sdk/react-native/user-management) object as prop to the ConversationsWithMessages component. This will automatically direct you to the [Messages](/ui-kit/react-native/v4/messages) component for the specified `User`.

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import { CometChat } from "@cometchat/chat-sdk-react-native";
    import { CometChatConversationsWithMessages } from "@cometchat/chat-uikit-react-native";

    const [user, setUser] = useState<CometChat.User | undefined>(undefined);

    const getUser = async () => {
      const user = await CometChat.getUser("uid");
      setUser(user);
    };

    useEffect(() => {
      getUser();
    }, []);

    return <CometChatConversationsWithMessages user={user} />;
    ```
  </Tab>
</Tabs>

***

##### Group Prop

You can pass a [Group](/sdk/react-native/groups-overview) object as input to the ConversationsWithMessages component. This will automatically direct you to the [Messages](/ui-kit/react-native/v4/messages) component for the specified `Group`.

<Tabs>
  <Tab title="ConversationsWithMessagesDemo.tsx">
    ```tsx theme={null}
    import { CometChat } from "@cometchat/chat-sdk-react-native";
    import { CometChatConversationsWithMessages } from "@cometchat/chat-uikit-react-native";

    const [group, setGroup] = useState<CometChat.Group | undefined>(undefined);

    const getGroup = async () => {
      const group = await CometChat.getGroup("guid");
      setGroup(group);
    };

    useEffect(() => {
      getGroup();
    }, []);

    return <CometChatConversationsWithMessages user={user} />;
    ```
  </Tab>
</Tabs>

***

##### Components

Nearly all functionality customizations available for a Component are also available for the composite component. Using [Configuration](#configurations), you can modify the properties of its components to suit your needs.

You can find the list of all Functionality customization of individual components in [Conversations](/ui-kit/react-native/v4/conversations#functionality) , [Messages](/ui-kit/react-native/v4/messages#functionality), and [Contacts](/ui-kit/react-native/v4/contacts#properties)

**Example**

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import {
      CometChatConversationsWithMessages,
      ConversationsConfigurationInterface,
      MessagesConfigurationInterface,
    } from "@cometchat/chat-uikit-react-native";

    const conversationsConfiguration: ConversationsConfigurationInterface = {
      disableTyping: true,
      showBackButton: true,
    };

    const messagesConfiguration: MessagesConfigurationInterface = {
      disableTyping: true,
      hideMessageHeader: true,
    };
    return (
      <CometChatConversationsWithMessages
        conversationsConfiguration={conversationsConfiguration}
        messagesConfigurations={messagesConfiguration}
      />
    );
    ```
  </Tab>
</Tabs>

***

### 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 own views, layouts, and UI elements and then incorporate those into the component.

By utilizing the [Configuration](#configurations) object of each component, you can apply advanced-level customizations to the ConversationsWithMessages.

**Example**

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import {
      CometChatConversationsWithMessages,
      ConversationsConfigurationInterface,
    } from "@cometchat/chat-uikit-react-native";

    const errorViewStyle: StyleProp<ViewStyle> = {
      flex: 1,
      alignItems: "center",
      justifyContent: "center",
      padding: 10,
      borderColor: "black",
      borderWidth: 1,
      backgroundColor: "#E8EAE9",
    };

    const getErrorStateView = () => {
      return (
        <View style={errorViewStyle}>
          <Text>Something Went Wrong!</Text>
        </View>
      );
    };

    const conversationsConfiguration: ConversationsConfigurationInterface = {
      ErrorStateView: getErrorStateView,
    };

    return (
      <CometChatConversationsWithMessages
        conversationsConfiguration={conversationsConfiguration}
      />
    );
    ```
  </Tab>
</Tabs>

***

To find all the details on individual Component advance customization you can refer, [Conversations Advance](/ui-kit/react-native/v4/conversations#advanced),[Messages Advance](/ui-kit/react-native/v4/messages#advanced) and Contacts.

ConversationsWithMessages uses advanced-level customization of both Conversation & Messages components to achieve its default behavior.

1. ConversationsWithMessages utilizes the \[AppBar Options]\(/ui-kit/react-native/v4/conversations#AppBar Options) of the `Conversations` subcomponent to navigate the user from [Conversations](/ui-kit/react-native/v4/conversations) to [Contacts](/ui-kit/react-native/v4/contacts)

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/iIeExfBhmmmkVYg_/images/5e092cae-contacts_cometchat_screens-b356715fb09eff1a5ed208722fc589b8.png?fit=max&auto=format&n=iIeExfBhmmmkVYg_&q=85&s=367304d2010b091fca40c4524f0e6302" alt="Image" width="4498" height="3120" data-path="images/5e092cae-contacts_cometchat_screens-b356715fb09eff1a5ed208722fc589b8.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/VF5v8Yrr3_dtKi2l/images/22a3b460-contacts_cometchat_screens-deae3f7fc831e03ae9da11dca6fb6431.png?fit=max&auto=format&n=VF5v8Yrr3_dtKi2l&q=85&s=6481d349736aca5d95826993789a5799" alt="Image" width="4498" height="3120" data-path="images/22a3b460-contacts_cometchat_screens-deae3f7fc831e03ae9da11dca6fb6431.png" />
  </Tab>
</Tabs>

2. ConversationsWithMessages utilizes the [AppBar Options](/ui-kit/react-native/v4/messages#auxilaryappbaroptions) of the `Messages` subcomponent to navigate from [Messages](/ui-kit/react-native/v4/messages) to [Details](/ui-kit/react-native/v4/group-details)

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/aivwqvtoO_fTqj20/images/f490c6f9-details_cometchat_screens-786f9e16636be5177545f9d5304c1f66.png?fit=max&auto=format&n=aivwqvtoO_fTqj20&q=85&s=a7446bc743cf07e3713a2c8c8643be10" alt="Image" width="4498" height="3136" data-path="images/f490c6f9-details_cometchat_screens-786f9e16636be5177545f9d5304c1f66.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/NKRwOrdYfqQN0SpG/images/fcc4f9df-details_cometchat_screens-4032e3cea9cfacb43dcaaf86807d04de.png?fit=max&auto=format&n=NKRwOrdYfqQN0SpG&q=85&s=1672a6c0f241eb4978fe9e539b7eb467" alt="Image" width="4498" height="3120" data-path="images/fcc4f9df-details_cometchat_screens-4032e3cea9cfacb43dcaaf86807d04de.png" />
  </Tab>
</Tabs>

<Warning>
  When you override `AppBarOptions`, the default behavior of ConversationsWithMessages will also be overridden.
</Warning>

## Configurations

[Configurations](/ui-kit/react-native/v4/components-overview#configurations) offer the ability to customize the properties of each component within a Composite Component.

ConversationsWithMessages has `Conversations`, `Messages`, and `Contacts` component. Hence, each of these components will have its individual \`Configuration\`\`.

* `Configurations` expose properties that are available in its individual components.

#### Conversations

You can customize the properties of the Conversations component by making use of the conversationsConfiguration. You can accomplish this by employing the `conversationsConfiguration` props as demonstrated below:

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import {
      CometChatConversationsWithMessages,
      ConversationsConfigurationInterface,
    } from "@cometchat/chat-uikit-react-native";

    const conversationsConfiguration: ConversationsConfigurationInterface = {
      //override properties
    };

    return (
      <CometChatConversationsWithMessages
        conversationsConfiguration={conversationsConfiguration}
      />
    );
    ```
  </Tab>
</Tabs>

All exposed properties of `ConversationsConfiguration` can be found under [Conversations](/ui-kit/react-native/v4/conversations#functionality).

**Example**

Let's say you want to change the style of the Conversations subcomponent and, in addition, you only want to display users in the conversation list.

You can modify the style using the `conversationsStyle` property and filter the list with the `conversationsRequestBuilder` property.

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/ISrSQKUqQ1MtSM8O/images/3231134e-convo_configuration_cometchat_screens-10074d4b5dea79517e153933acb810a9.png?fit=max&auto=format&n=ISrSQKUqQ1MtSM8O&q=85&s=bc76b4223716234b12dec3854fd34cb0" alt="Image" width="4498" height="3120" data-path="images/3231134e-convo_configuration_cometchat_screens-10074d4b5dea79517e153933acb810a9.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/see6b5g_JfKPgfLq/images/3db07575-convo_configuration_cometchat_screens-275dc078b1b9787721c86a4fa0a5706d.png?fit=max&auto=format&n=see6b5g_JfKPgfLq&q=85&s=f2a9a4b7a87901bd6765ad9bc8118d8f" alt="Image" width="4498" height="3120" data-path="images/3db07575-convo_configuration_cometchat_screens-275dc078b1b9787721c86a4fa0a5706d.png" />
  </Tab>
</Tabs>

<Tabs>
  <Tab title="TypeScript">
    ```ts theme={null}
    import {
      CometChatConversationsWithMessages,
      ConversationsConfigurationInterface,
      ConversationsStyle,
    } from "@cometchat/chat-uikit-react-native";

    import { CometChat } from "@cometchat/chat-sdk-react-native";

    const conversationsConfiguration: ConversationsConfigurationInterface = {
      conversationsStyle: {
        width: "100%",
        height: "100%",
        backgroundColor: "#d5dde8",
        titleColor: "#6851D6",
      },
      listItemStyle: {
        backgroundColor: "#d5dde8",
      },
      conversationsRequestBuilder:
        new CometChat.ConversationsRequestBuilder().setLimit(5),
    };

    return (
      <CometChatConversationsWithMessages
        conversationsConfiguration={conversationsConfiguration}
      />
    );
    ```
  </Tab>
</Tabs>

***

#### Messages

You can customize the properties of the Messages component by making use of the messagesConfiguration. You can accomplish this by employing the `messagesConfiguration` props as demonstrated below:

<Tabs>
  <Tab title="TypeScript">
    ```ts theme={null}
    import {
      CometChatConversationsWithMessages,
      MessagesConfigurationInterface,
    } from "@cometchat/chat-uikit-react-native";

    const messagesConfiguration: MessagesConfigurationInterface = {
      //override properties
    };
    return (
      <CometChatConversationsWithMessages
        messagesConfigurations={messagesConfiguration}
      />
    );
    ```
  </Tab>
</Tabs>

All exposed properties of `MessagesConfiguration` can be found under [Messages](/ui-kit/react-native/v4/messages#configuration).

**Example**

Let's say you want to change the style of the Messages subcomponent and, in addition, you only want to hide message header.

You can modify the style using the `messagesStyle` property and hide the message header with the `hideMessageHeader` property.

<Tabs>
  <Tab title="TypeScript">
    ```ts theme={null}
    import {
      CometChatConversationsWithMessages,
      MessagesConfigurationInterface,
    } from "@cometchat/chat-uikit-react-native";

    const messagesConfiguration: MessagesConfigurationInterface = {
      hideMessageHeader: true,
      messagesStyle: {
        backgroundColor: "grey",
      },
    };

    return (
      <CometChatConversationsWithMessages
        messagesConfigurations={messagesConfiguration}
      />
    );
    ```
  </Tab>
</Tabs>

***

#### Contacts

You can customize the properties of the Contacts component by making use of the ContactsConfiguration. You can accomplish this by employing the `startConversationConfiguration` props as demonstrated below:

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import {
      CometChatConversationsWithMessages,
      ContactsConfigurationInterface,
    } from "@cometchat/chat-uikit-react-native";

    const contactsConfiguration: ContactsConfigurationInterface = {
      //override properties
    };

    return (
      <CometChatConversationsWithMessages
        startConversationConfiguration={contactsConfiguration}
      />
    );
    ```
  </Tab>
</Tabs>

All exposed properties of `ContactsConfiguration` can be found under [Contacts](/ui-kit/react-native/v4/contacts#properties).

**Example**

Let's say you want to change the style of the Contacts subcomponent and, in addition, you only want to hide the submit button.

You can modify the style using the `contactsStyle` property and hide the submit button with the `hideSubmitButton` property.

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import {
      CometChatConversationsWithMessages,
      ContactsConfigurationInterface,
    } from "@cometchat/chat-uikit-react-native";

    const contactsConfiguration: ContactsConfigurationInterface = {
      hideSubmit: true,
      contactsStyle: {
        titleTextColor: "red",
      },
    };

    return (
      <CometChatConversationsWithMessages
        startConversationConfiguration={contactsConfiguration}
      />
    );
    ```
  </Tab>
</Tabs>

***
