> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-rn-guide-message-privately.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Groups

> Groups — CometChat documentation.

The Groups is a [Component](/ui-kit/react-native/v4/components-overview#components), showcasing an accessible list of all available groups. It provides an integral search functionality, allowing you to locate any specific groups swiftly and easily. For each group listed, the group name is displayed by default, in conjunction with the group icon when available. Additionally, it provides a useful feature by displaying the number of members in each group as a subtitle, offering valuable context about group size and activity level.

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/fxK75AS6FzDL1Oqo/images/b8d90d23-groups_overview_cometchat_screens-7369417439d2ff128c7e8ddd9a5b47d6.png?fit=max&auto=format&n=fxK75AS6FzDL1Oqo&q=85&s=47c4ac466e4caf51b63ad418431bf1c1" alt="Image" width="4498" height="3120" data-path="images/b8d90d23-groups_overview_cometchat_screens-7369417439d2ff128c7e8ddd9a5b47d6.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/Xgdtn9VZPDi47bm-/images/278e4e78-groups_overview_cometchat_screens-fb7864e374d123b0cada6ce3ea9be8b3.png?fit=max&auto=format&n=Xgdtn9VZPDi47bm-&q=85&s=0de8ca71c0fafbb3ab171bc08fee92ce" alt="Image" width="4498" height="3120" data-path="images/278e4e78-groups_overview_cometchat_screens-fb7864e374d123b0cada6ce3ea9be8b3.png" />
  </Tab>
</Tabs>

The Groups component is composed of the following BaseComponents:

| Components                                    | Description                                                                                                             |
| --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| CometChatList                                 | a reusable container component having title, search box, customisable background and a List View                        |
| [ListItem](/ui-kit/react-native/v4/list-item) | a component that renders data obtained from a User object on a Tile having a title, subtitle, leading and trailing view |

***

## Usage

### Integration

The following code snippet illustrates how you can directly incorporate the Groups component into your `App.tsx` file.

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

    function App(): React.JSX.Element {
      return <CometChatGroups />;
    }
    ```
  </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.

##### 1. onSelection

The `onSelection` event is activated when you select the done icon in the AppBar while in selection mode. This returns a list of all the Groups that you have selected.

This action does not come with any predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.

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

    function App(): React.JSX.Element {
      const onSelectionHandler = (list: CometChat.Group[]) => {
        //code
      };

      return (
        <CometChatGroups
          onSelection={onSelectionHandler}
          selectionMode="multiple"
        />
      );
    }
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/2JiXkJ8lq6PmPGlJ/images/733f4670-groups_selection_cometchat_screens-d80f067d06311debf281297997e0a841.png?fit=max&auto=format&n=2JiXkJ8lq6PmPGlJ&q=85&s=97c552230027fe709c50ae23862b55cc" alt="Image" width="4498" height="3120" data-path="images/733f4670-groups_selection_cometchat_screens-d80f067d06311debf281297997e0a841.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/jpEUuHUk-hvu4tQT/images/a9e93690-groups_selection_cometchat_screens-4502398653a481a7d1387bd6d7d3b1b3.png?fit=max&auto=format&n=jpEUuHUk-hvu4tQT&q=85&s=4ac5bd69b2f519542831436c51a7e13c" alt="Image" width="4498" height="3120" data-path="images/a9e93690-groups_selection_cometchat_screens-4502398653a481a7d1387bd6d7d3b1b3.png" />
  </Tab>
</Tabs>

##### 2. onItemPress

The `onItemPress` event is activated when you press on the Group item. This action does not come with any predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.

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

    function App(): React.JSX.Element {
      const onItemPresshandler = (user: CometChat.User) => {
        //code
      };

      return (
        <CometChatGroups selectionMode="none" onItemPress={onItemPresshandler} />
      );
    }
    ```
  </Tab>
</Tabs>

##### 3. onItemLongPress

The `onItemLongPress` event is activated when you Long Press on the Group item. This action does not come with any predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.

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

    function App(): React.JSX.Element {
      const onItemLongPresshandler = (group: CometChat.Group) => {
        //code
      };

      return (
        <CometChatGroups
          selectionMode={"none"}
          onItemLongPress={onItemLongPresshandler}
        />
      );
    }
    ```
  </Tab>
</Tabs>

##### 4. onBack

The `onBack` function is built to respond when you press the back button in the AppBar. The back button is only displayed when the prop `showBackButton` is set to true.

By default, this action does not have a predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.

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

    function App(): React.JSX.Element {
      const onBackHandler = () => {
        //code
      };

      return <CometChatGroups showBackButton={true} onBack={onBackHandler} />;
    }
    ```
  </Tab>
</Tabs>

##### 5. onError

This action doesn't change the behavior of the component but rather listens for any errors that occur in the Groups component.

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

    function App(): React.JSX.Element {
      const onErrorHandler = (error: CometChat.CometChatException) => {
        //code
      };

      return <CometChatGroups onError={onErrorHandler} />;
    }
    ```
  </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.

##### 1. GroupsRequestBuilder

The [GroupsRequestBuilder](/sdk/react-native/retrieve-groups) enables you to filter and customize the group list based on available parameters in [GroupsRequestBuilder](/sdk/react-native/retrieve-groups). This feature allows you to create more specific and targeted queries when fetching groups. The following are the parameters available in [GroupsRequestBuilder](/sdk/react-native/retrieve-groups)

| Methods              | Type           | Description                                                                             |
| -------------------- | -------------- | --------------------------------------------------------------------------------------- |
| **setLimit**         | number         | sets the number groups that can be fetched in a single request, suitable for pagination |
| **setSearchKeyword** | string         | used for fetching groups matching the passed string                                     |
| **joinedOnly**       | boolean        | to fetch only joined groups                                                             |
| **friendsOnly**      | boolean        | used for fetching only those users in which logged in user is a member                  |
| **setTags**          | Array\<string> | used for fetching groups containing the passed tags                                     |
| **withTags**         | boolean        | used to fetch tags data along with the list of groups                                   |

**Example**

In the example below, we are applying a filter to the Group List based on only joined groups and setting the limit to ten.

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

    function App(): React.JSX.Element {
      const groupsRequestBuilder = new CometChat.GroupsRequestBuilder()
        .setLimit(10)
        .joinedOnly(true);

      return (
        <CometChatGroups
          selectionMode="none"
          groupsRequestBuilder={groupsRequestBuilder}
        />
      );
    }
    ```
  </Tab>
</Tabs>

##### 2. SearchRequestBuilder

The SearchRequestBuilder uses [GroupsRequestBuilder](/sdk/react-native/retrieve-groups) enables you to filter and customize the search list based on available parameters in [GroupsRequestBuilder](/sdk/react-native/retrieve-groups).

**Example**

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

    function App(): React.JSX.Element {
      const searchRequestBuilder = new CometChat.GroupsRequestBuilder()
        .setLimit(10)
        .setSearchKeyword("custom-keyword");

      return (
        <CometChatGroups
          selectionMode="none"
          searchRequestBuilder={searchRequestBuilder}
        />
      );
    }
    ```
  </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.

To handle events supported by Groups you have to add corresponding listeners by using `CometChatGroupEvents`.

The Groups component does not produce any events directly.

***

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

You can set the `GroupsStyle` to the Groups Component to customize the styling.

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/PrOf0fpV33FkfOMB/images/18078f42-groups_style_cometchat_screens-670413dac02e5bf8c77ee39fe0e4c86c.png?fit=max&auto=format&n=PrOf0fpV33FkfOMB&q=85&s=6cf4ef4063abae3370bde7fd019b2e78" alt="Image" width="4498" height="3120" data-path="images/18078f42-groups_style_cometchat_screens-670413dac02e5bf8c77ee39fe0e4c86c.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/jpEUuHUk-hvu4tQT/images/a7f13674-groups_style_cometchat_screens-ff8d43fca4a3dcde751a91f6d19e7503.png?fit=max&auto=format&n=jpEUuHUk-hvu4tQT&q=85&s=3447ff84f30d79003a723939b0c6f5aa" alt="Image" width="4498" height="3120" data-path="images/a7f13674-groups_style_cometchat_screens-ff8d43fca4a3dcde751a91f6d19e7503.png" />
  </Tab>
</Tabs>

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

    function App(): React.JSX.Element {
      const groupsStyle: GroupsStyleInterface = {
        titleColor: "red",
        backgroundColor: "#d2cafa",
      };

      return <CometChatGroups groupsStyle={groupsStyle} />;
    }
    ```
  </Tab>
</Tabs>

List of properties exposed by GroupsStyle

| Property                        | Description                                                                                                      | Code                                       |
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
| **border**                      | Used to set border                                                                                               | `border?: BorderStyleInterface,`           |
| **borderRadius**                | Used to set border radius                                                                                        | `borderRadius?: number;`                   |
| **backgroundColor**             | Used to set background colour                                                                                    | `background?: string;`                     |
| **height**                      | Used to set height                                                                                               | `height?: number` \| `string;`             |
| **width**                       | Used to set width                                                                                                | `width?: number` \| `string;`              |
| **titleFont**                   | Used to customise the font of the title in the app bar                                                           | `titleFont?: FontStyleInterface;`          |
| **titleColor**                  | Used to customise the color of the title in the app bar                                                          | `titleColor?: string;`                     |
| **backIconTint**                | Used to set the tint for the back button                                                                         | `backIconTint?: string`                    |
| **searchBorder**                | Used to set search box border                                                                                    | `searchBorder?: BorderStyleInterface,`     |
| **searchBorderRadius**          | Used to set search box border radius                                                                             | `searchBorderRadius?: number;`             |
| **searchBackgroundColor**       | Used to set search box background colour                                                                         | `searchBackgroundColor?: string;`          |
| **searchTextFont**              | Used to customise the font of the search box in the app bar                                                      | `searchTextFont?: FontStyleInterface;`     |
| **searchTextColor**             | Used to customise the color of the search box in the app bar                                                     | `searchTextColor?: string;`                |
| **searchPlaceholderTextColor**  | Used to set the color of the placeholder text in the search box                                                  | `searchPlaceholderTextColor?: string;`     |
| **searchIconTint**              | Used to set the tint for the search icon tint                                                                    | `searchIconTint?: string`                  |
| **emptyTextColor**              | Used to empty state text color                                                                                   | `emptyTextColor?: string`                  |
| **emptyTextFont**               | Used to empty state text font                                                                                    | `emptyTextFont?: FontStyleInterface`       |
| **errorTextColor**              | Used to set the font style of the response text shown in case some error occurs while fetching the list of users | `errorTextColor?: string;`                 |
| **errorTextFont**               | Used to set the font style of the response text shown in case some error occurs while fetching the list of users | `errorTextFont?: FontStyleInterface;`      |
| **subtitleTextColor**           | Used to set the color for group item subtitle                                                                    | `subtitleTextColor?: string;`              |
| **subtitleTextFont**            | Used to set the font style for group item subtitle                                                               | `subtitleTextFont?: FontStyleInterface;`   |
| **separatorColor**              | Used to set the color of the divider separating the group member items                                           | `separatorColor?: string;`                 |
| **loadingIconTint**             | Used to set the color of the icon shown while the list of users is being fetched                                 | `loadingIconTint?: string;`                |
| **privateGroupIconBackground**  | Sets background image of private group Icon                                                                      | `privateGroupIconBackground?: ImageType;`  |
| **passwordGroupIconBackground** | Sets background image of protected group Icon                                                                    | `passwordGroupIconBackground?: ImageType;` |

##### 2. Avatar Style

To apply customized styles to the `Avatar` component in the Groups Component, you can use the following code snippet. For further insights on `Avatar` Styles [refer](/ui-kit/react-native/v4/avatar)

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

    function App(): React.JSX.Element {
      const avatarStyle: AvatarStyleInterface = {
        outerViewSpacing: 5,
        outerView: {
          borderWidth: 2,
          borderStyle: "dotted",
          borderColor: "blue",
        },
        border: borderStyle,
      };

      return <CometChatGroups avatarStyle={avatarStyle} />;
    }
    ```
  </Tab>
</Tabs>

##### 3. StatusIndicator Style

To apply customized styles to the Status Indicator component in the Groups Component, You can use the following code snippet. For further insights on Status Indicator Styles [refer](/ui-kit/react-native/v4/status-indicator)

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

    function App(): React.JSX.Element {
      const statusIndicatorStyle: StatusIndicatorStyleInterface = {
        backgroundColor: "grey",
      };

      return <CometChatGroups statusIndicatorStyle={statusIndicatorStyle} />;
    }
    ```
  </Tab>
</Tabs>

##### 3. LisItem Style

To apply customized styles to the List Item component in the Groups Component, you can use the following code snippet. For further insights on List Item Styles [refer](/ui-kit/react-native/v4/list-item)

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

    function App(): React.JSX.Element {
      const listItemStyle: ListItemStyleInterface = {
        titleColor: "red",
        backgroundColor: "#e4e1f0",
      };

      return <CometChatGroups listItemStyle={listItemStyle} />;
    }
    ```
  </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.

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/mkn0UqPQ5BXljCV1/images/9418860e-groups_func_cometchat_screens-6f5cb1c983079bee015a5103576ac519.png?fit=max&auto=format&n=mkn0UqPQ5BXljCV1&q=85&s=17ef9abb8959d3de15e46a5dacbc85ef" alt="Image" width="4498" height="3120" data-path="images/9418860e-groups_func_cometchat_screens-6f5cb1c983079bee015a5103576ac519.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/mq8rEbFfi0JjKmkM/images/66799f5f-groups_func_cometchat_screens-c9058b6fd33f9792b61a76aebc08b7dc.png?fit=max&auto=format&n=mq8rEbFfi0JjKmkM&q=85&s=6d516dd8be41c61b7cbac523e0ec65ef" alt="Image" width="4498" height="3120" data-path="images/66799f5f-groups_func_cometchat_screens-c9058b6fd33f9792b61a76aebc08b7dc.png" />
  </Tab>
</Tabs>

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

    function App(): React.JSX.Element {
      return <CometChatGroups title="Groups List" hideSearch={true} />;
    }
    ```
  </Tab>
</Tabs>

Below is a list of customizations along with corresponding code snippets

| Property                                                     | Description                                                                                   | Code                             |
| ------------------------------------------------------------ | --------------------------------------------------------------------------------------------- | -------------------------------- |
| **title**                                                    | Used to set title in the app bar                                                              | `title?: string`                 |
| **searchPlaceholderText**                                    | Used to set search placeholder text                                                           | `searchPlaceHolderText?: string` |
| **errorStateText** <Tooltip tip="Not available">🛑</Tooltip> | Used to set a custom text response when some error occurs on fetching the list of groups      | `errorStateText?: string`        |
| **emptyStateText** <Tooltip tip="Not available">🛑</Tooltip> | Used to set a custom text response when fetching the groups has returned an empty list        | `emptyStateText?: string`        |
| **searchBoxIcon**                                            | Used to set search Icon in the search field                                                   | `searchBoxIcon?: ImageType`      |
| **privateGroupIcon**                                         | Used to set the private group Icon                                                            | `privateGroupIcon?: ImageType`   |
| **passwordGroupIcon**                                        | Used to set the protected group Icon                                                          | `passwordGroupIcon?: ImageType`  |
| **hideSearch**                                               | Used to toggle visibility for search box                                                      | `hideSearch?: boolean`           |
| **hideError**                                                | Used to hide error on fetching groups                                                         | `hideError?: boolean`            |
| **hideSeperator**                                            | Used to hide the divider separating the group items                                           | `hideSeperator?: boolean`        |
| **selectionMode**                                            | set the number of groups that can be selected, SelectionMode can be single, multiple or none. | `selectionMode? SelectionMode`   |
| **hideSubmitIcon**                                           | Used to hide the selection submit icon                                                        | `hideSubmitIcon?: boolean`       |
| **backButtonIcon**                                           | Used to set the back button icon                                                              | `backButtonIcon?: ImageType`     |
| **showBackButton**                                           | Used to hide or show the back button                                                          | `showBackButton?: boolean`       |

***

### 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 property, you can assign a custom ListItem to the Groups Component.

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

    function App(): React.JSX.Element {
      const viewStyle: StyleProp<ViewStyle> = {
        flex: 1,
        flexDirection: "row",
        alignItems: "flex-start",
        padding: 10,
        borderColor: "black",
        borderWidth: 1,
        backgroundColor: "#E8EAE9",
        borderRadius: 10,
        margin: 2,
      };

      const getListItemView = (group: CometChat.Group) => {
        return (
          <View style={viewStyle}>
            <CometChatAvatar
              image={group.getIcon() ? { uri: group.getIcon() } : undefined}
              name={group.getName()}
            />

            <View>
              <Text style={{ color: "black", fontWeight: "bold" }}>
                {group.getName()}
              </Text>
              <Text style={{ color: "#667" }}>
                Members: {group.getMembersCount()}
              </Text>
            </View>
          </View>
        );
      };

      return <CometChatGroups ListItemView={getListItemView} />;
    }
    ```
  </Tab>
</Tabs>

**Example**

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/XgQ9DxAoWn0btB5m/images/5c82500b-groups_list_item_view_cometchat_screens-f61c31bd8ce73ef10ef309f2d911f1cd.png?fit=max&auto=format&n=XgQ9DxAoWn0btB5m&q=85&s=74de9319fa50675db9cc2291ddd39b2c" alt="Image" width="4498" height="3120" data-path="images/5c82500b-groups_list_item_view_cometchat_screens-f61c31bd8ce73ef10ef309f2d911f1cd.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/7a4hqm7gLVRmX34O/images/0163e06b-groups_list_item_view_cometchat_screens-9705edafad9de81f9495a1a0c2f82e7d.png?fit=max&auto=format&n=7a4hqm7gLVRmX34O&q=85&s=67b5fbea8a1d79795fe61981708fa2e3" alt="Image" width="4498" height="3120" data-path="images/0163e06b-groups_list_item_view_cometchat_screens-9705edafad9de81f9495a1a0c2f82e7d.png" />
  </Tab>
</Tabs>

***

#### SubtitleView

You can customize the subtitle view for each group item to meet your requirements

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}

    import {CometChat} from '@cometchat/chat-sdk-react-native';
    import { CometChatGroups } from '@cometchat/chat-uikit-react-native';

    function App(): React.JSX.Element {

    const getSubtitleView = (group: CometChat.Group) => {
    return (
    <Text
    style={{
          fontSize: 12,
          color: theme.palette.getAccent800(),
        }}>
    Members Count:
    {group?.getMembersCount()}
    </Text>
    );
    }

    return (
    <CometChatGroups
          SubtitleView={getSubtitleView}
      />
    );
    }
    ```
  </Tab>
</Tabs>

**Example**

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/FGBCGWXGo5d9bVxR/images/c38282b5-groups_subtitle_view_cometchat_screens-c8b991f33a3589b109ca8e78d96b5c20.png?fit=max&auto=format&n=FGBCGWXGo5d9bVxR&q=85&s=868da10556760a0f48cae573f9edc928" alt="Image" width="4498" height="3120" data-path="images/c38282b5-groups_subtitle_view_cometchat_screens-c8b991f33a3589b109ca8e78d96b5c20.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/2SVOPiSpm0QEqRoz/images/f10c3c2c-groups_subtitle_view_cometchat_screens-7a85bd87ed9287330f6c7b000b5f50eb.png?fit=max&auto=format&n=2SVOPiSpm0QEqRoz&q=85&s=4b3ba99bf6864caa5c13fa2a1c764b08" alt="Image" width="4498" height="3120" data-path="images/f10c3c2c-groups_subtitle_view_cometchat_screens-7a85bd87ed9287330f6c7b000b5f50eb.png" />
  </Tab>
</Tabs>

***

#### LoadingStateView

You can set a custom loader view using `LoadingStateView` to match the loading view of your app.

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

    function App(): React.JSX.Element {
      const loadingViewStyle: StyleProp<ViewStyle> = {
        flex: 1,
        alignItems: "center",
        justifyContent: "center",
        padding: 10,
        borderColor: "black",
        borderWidth: 1,
        backgroundColor: "#E8EAE9",
      };

      const getLoadingStateView = () => {
        return (
          <View style={loadingViewStyle}>
            <Text style={{ fontSize: 20, color: "black" }}>Loading...</Text>
          </View>
        );
      };

      return <CometChatGroups LoadingStateView={getLoadingStateView} />;
    }
    ```
  </Tab>
</Tabs>

**Example**

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/mq8rEbFfi0JjKmkM/images/63320c22-groups_loading_state_view_cometchat_screens-47f4fca11ed6a8d79f71a06560c380e1.png?fit=max&auto=format&n=mq8rEbFfi0JjKmkM&q=85&s=7278df7b6c4dedef3a515c0bf65102b0" alt="Image" width="4498" height="3120" data-path="images/63320c22-groups_loading_state_view_cometchat_screens-47f4fca11ed6a8d79f71a06560c380e1.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/le8ibYc8lBJsShSE/images/5232c78d-groups_loading_state_view_cometchat_screens-d16e12b1d4ee7926edfdb3981f1901ca.png?fit=max&auto=format&n=le8ibYc8lBJsShSE&q=85&s=1da831f373f8f270027c1391ae2db244" alt="Image" width="4498" height="3120" data-path="images/5232c78d-groups_loading_state_view_cometchat_screens-d16e12b1d4ee7926edfdb3981f1901ca.png" />
  </Tab>
</Tabs>

***

#### EmptyStateView

You can set a custom `EmptyStateView` using `EmptyStateView` prop to match the empty view of your app.

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}

    import {CometChat} from '@cometchat/chat-sdk-react-native';
    import { CometChatGroups } from '@cometchat/chat-uikit-react-native';

    function App(): React.JSX.Element {

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

    const getEmptyStateView = () => {
    return (
    <View style={emptyViewStyle}>
    <Text style={{fontSize: 80, color: "black"}}>Empty</Text>
    </View>
    );
    };

    //use a keyword that does not exist so that empty state view gets rendered
    const searchRequestBuilder = new CometChat.GroupsRequestBuilder().setLimit(10).setSearchKeyword('does-not-exist');

    return (
    <CometChatGroups
          searchRequestBuilder={searchRequestBuilder}
          EmptyStateView={getEmptyStateView}
      />
    );
    }
    ```
  </Tab>
</Tabs>

**Example**

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/3EDM5JvI4mnAULac/images/7c40dd06-groups_empy_state_view_cometchat_screens-3ef5a54a7151317674ac63882c8a353e.png?fit=max&auto=format&n=3EDM5JvI4mnAULac&q=85&s=8f3dec9ef0d0e8a42fbdccecffc5ec48" alt="Image" width="4498" height="3120" data-path="images/7c40dd06-groups_empy_state_view_cometchat_screens-3ef5a54a7151317674ac63882c8a353e.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/ubfBSdV1t6rmjxeA/images/8b728f28-groups_empy_state_view_cometchat_screens-084d07738bcba602893758313ff63b88.png?fit=max&auto=format&n=ubfBSdV1t6rmjxeA&q=85&s=1e6e85bfb6d8a4340ebc6fd3a325bb1c" alt="Image" width="4498" height="3120" data-path="images/8b728f28-groups_empy_state_view_cometchat_screens-084d07738bcba602893758313ff63b88.png" />
  </Tab>
</Tabs>

***

#### AppBarOptions

You can set Custom AppBarOptions to add more options to the Groups component.

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}

    import {CometChat} from '@cometchat/chat-sdk-react-native';
    import { CometChatGroups } from '@cometchat/chat-uikit-react-native';
    import Notification from './push-notification.png';

    function App(): React.JSX.Element {

    const styles = StyleSheet.create({
    button: {
    height: 20,
    width: 20,
    borderRadius: 0,
    backgroundColor: 'transparent',
    },
    image: {
    height: 20,
    width: 20,
    tintColor: '#7E57C2',
    },
    });

    const getAppBarOptions = () => {
    return (
    <TouchableOpacity style={styles.button} onPress={() => {/_code_/}}>
    <Image source={Notification} style={styles.image} />
    </TouchableOpacity>
    );
    };

    return (
    <CometChatGroups
         AppBarOption={getAppBarOptions}
      />
    );
    }
    ```
  </Tab>
</Tabs>

**Example**

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/21UBnagXOw-XG0Sv/images/b274bea4-groups_app_bar_options_cometchat_screens-173d30dad0687af2118b314658cfbfbb.png?fit=max&auto=format&n=21UBnagXOw-XG0Sv&q=85&s=36b55daf455f60ee477b8ba547a604e1" alt="Image" width="4498" height="3120" data-path="images/b274bea4-groups_app_bar_options_cometchat_screens-173d30dad0687af2118b314658cfbfbb.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/OOBJyP9hM0C-rAe_/images/d9b2cff1-groups_app_bar_options_cometchat_screens-1b4cf1b288c13f5cfeb70c1e9f5904f5.png?fit=max&auto=format&n=OOBJyP9hM0C-rAe_&q=85&s=4aa805821a13683e4c64c73925e70f41" alt="Image" width="4498" height="3120" data-path="images/d9b2cff1-groups_app_bar_options_cometchat_screens-1b4cf1b288c13f5cfeb70c1e9f5904f5.png" />
  </Tab>
</Tabs>

***

#### Swipe Options

You can set Custom Swipe options to the Groups component.

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}

    import {CometChat} from '@cometchat/chat-sdk-react-native';
    import { CometChatGroups, CometChatOptions } from '@cometchat/chat-uikit-react-native';
    import Call from './Call.png';

    function App(): React.JSX.Element {

    const getCustomOptions = (
    user: CometChat.User,
    ) => {
    const customOption: CometChatOptions = ({
    id: "custom id",
    title: "Call",
    icon: Call,
    iconTint: "#7316f5",
    backgroundColor: "#93f5bf",
    onPress: () => console.log("custom action"),
    });

    return (
      <CometChatGroups
          options={getCustomOptions}
      />

    );
    }
    ```
  </Tab>
</Tabs>

**Example**

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/jpEUuHUk-hvu4tQT/images/a43d1b77-groups_swipe_bar_options_cometchat_screens-179213a38088257b7bb6edf08c823dbb.png?fit=max&auto=format&n=jpEUuHUk-hvu4tQT&q=85&s=eb0d8dcf0d9aedabb9bacbace815ccae" alt="Image" width="4498" height="3120" data-path="images/a43d1b77-groups_swipe_bar_options_cometchat_screens-179213a38088257b7bb6edf08c823dbb.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/JSRiWiPGBHsJZFCg/images/9e3411ed-groups_swipe_bar_options_cometchat_screens-4ca91f1f891dea2234b673b994ada45b.png?fit=max&auto=format&n=JSRiWiPGBHsJZFCg&q=85&s=499fdb901d399860f69b3b9b04526b63" alt="Image" width="4498" height="3120" data-path="images/9e3411ed-groups_swipe_bar_options_cometchat_screens-4ca91f1f891dea2234b673b994ada45b.png" />
  </Tab>
</Tabs>

***
