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

# Reactions

> Reactions — CometChat documentation.

The `CometChatReactions` component provides a visual representation of emoji reactions associated with a specific message. It enables users to quickly identify which emojis were used to react to the message and by whom.

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/Gp90C5sdVtuRR4t7/images/7f4401b1-reactions_overview_cometchat_screens-ff06de7087433dfeb011996de153ccf2.png?fit=max&auto=format&n=Gp90C5sdVtuRR4t7&q=85&s=eac53f0b0dad98e6aaf2107cb52fa8c6" alt="Image" width="4498" height="3120" data-path="images/7f4401b1-reactions_overview_cometchat_screens-ff06de7087433dfeb011996de153ccf2.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/mkn0UqPQ5BXljCV1/images/95f7ac7b-reactions_overview_cometchat_screens-d9df234e4670c3a2a8794b315ae00e18.png?fit=max&auto=format&n=mkn0UqPQ5BXljCV1&q=85&s=4b55fe1dfec2b05d7621bffc12ed246d" alt="Image" width="4498" height="3120" data-path="images/95f7ac7b-reactions_overview_cometchat_screens-d9df234e4670c3a2a8794b315ae00e18.png" />
  </Tab>
</Tabs>

## Usage

### Integration

The following code snippet illustrates how you can directly incorporate the Reactions component into your app.

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

    function App(): React.JSX.Element {
        const [chatUser, setChatUser] = React.useState<CometChat.User| undefined>();
        const [message, setMessage] = React.useState<CometChat.TextMessage | undefined>(undefined);

        React.useEffect(() => {
            CometChat.getUser("uid").then((user) => {
               setChatUser(user);
            })
            CometChat.getMessageDetails(messageId).then((message: any) => {
               setMessage(message);
            });
        }, []);

        return (
         <>
             {message && <CometChatReactions
                            messageObject={message}
                          >
                         </CometChatReactions>}
         </>
       );
      }
    ```
  </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. onReactionPress

`ReactionPress` is triggered when you press on each Reaction in the footer view of message bubble. You can override this action using the following code snippet.

```tsx theme={null}
onReactionPress = { onReactionPressHandler };
```

**Example**

In this example, we are employing the `onReactionPress` action.

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

    function App(): React.JSX.Element {
        const [chatUser, setChatUser] = React.useState<CometChat.User| undefined>();
        const [message, setMessage] = React.useState<CometChat.TextMessage | undefined>(undefined);

        React.useEffect(() => {
            CometChat.getUser("uid").then((user) => {
               setChatUser(user);
            })
            CometChat.getMessageDetails(messageId).then((message: any) => {
               setMessage(message);
            });
        }, []);

        const reactionsStyle : ReactionsStyleInterface = {
           backgroundColor:'red',
           primaryBackgroundColor: "#b067f5",
           primaryBorder: {
             borderWidth: 2,
             borderStyle: 'solid',
             borderColor: 'red'
          }
        };

        const onReactionPressHandler = (reaction: CometChat.ReactionCount, messageObject: CometChat.BaseMessage) => {
           //code
        }

        return (
         <>
             {message && <CometChatReactions
                            messageObject={message}
                            style={reactionsStyle}
                            onReactionPress={onReactionPressHandler}>
                         </CometChatReactions>}
         </>
       );
      }
    ```
  </Tab>
</Tabs>

##### 2. onReactionLongPress

`ReactionLongPress` is triggered when you press on each Reaction in the footer view of message bubble. You can override this action using the following code snippet.

```tsx theme={null}
onReactionLongPress = { onReactionLongPressHandler };
```

**Example**

In this example, we are employing the `onReactionLongPress` action.

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

    function App(): React.JSX.Element {
        const [chatUser, setChatUser] = React.useState<CometChat.User| undefined>();
        const [message, setMessage] = React.useState<CometChat.TextMessage | undefined>(undefined);

        React.useEffect(() => {
            CometChat.getUser("uid").then((user) => {
               setChatUser(user);
            })
            CometChat.getMessageDetails(messageId).then((message: any) => {
               setMessage(message);
            });
        }, []);

        const reactionsStyle : ReactionsStyleInterface = {
           backgroundColor:'red',
           primaryBackgroundColor: "#b067f5",
           primaryBorder: {
             borderWidth: 2,
             borderStyle: 'solid',
             borderColor: 'red'
          }
        };

        const onReactionLongPressHandler = (reaction: CometChat.ReactionCount, messageObject: CometChat.BaseMessage) => {
           //long
        }

        return (
         <>
             {message && <CometChatReactions
                            messageObject={message}
                            style={reactionsStyle}
                            onReactionLongPress={onReactionLongPressHandler}
                            >
                         </CometChatReactions>}
         </>
       );
      }
    ```
  </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.

The `Reactions` component does not have any exposed filters.

### 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 `Reactions` component does not produce any events.

## Customization

To fit your app's design requirements, you can customize the appearance of the Reaction 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. reactionsStyle

To customize the appearance, you can assign a `reactionsStyle` object to the `Reactions` component.

**Example**

In this example, we are employing the `reactionsStyle`.

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

    import React from "react";
    import { CometChat } from '@cometchat/chat-sdk-react-native';
    import { CometChatMessages, CometChatReactions, ReactionsStyleInterface } from '@cometchat/chat-uikit-react-native';

    function App(): React.JSX.Element {
        const [chatUser, setChatUser] = React.useState<CometChat.User| undefined>();
        const [message, setMessage] = React.useState<CometChat.TextMessage | undefined>(undefined);

        React.useEffect(() => {
            CometChat.getUser("uid").then((user) => {
               setChatUser(user);
            })
            CometChat.getMessageDetails(messageId).then((message: any) => {
               setMessage(message);
            });
        }, []);

        const reactionsStyle : ReactionsStyleInterface = {
           backgroundColor:'red',
           primaryBackgroundColor: "#b067f5",
           primaryBorder: {
             borderWidth: 2,
             borderStyle: 'solid',
             borderColor: 'red'
          }
        };


        return (
         <>
             {message && <CometChatReactions
                            messageObject={message}
                            onReactionPress={onReactionPressHandler}>
                         </CometChatReactions>}
         </>
       );
      }
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/19qJLi95IaEk2j9s/images/fd4f91d8-reactions_cometchat_screens-daaaf70067efad215d69e4310cdd91f7.png?fit=max&auto=format&n=19qJLi95IaEk2j9s&q=85&s=6c4b7aea814f5e05f83b51c79da8ca3d" alt="Image" width="4498" height="3120" data-path="images/fd4f91d8-reactions_cometchat_screens-daaaf70067efad215d69e4310cdd91f7.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/NN4EdpOU3viwWMb_/images/0796f7b5-reactions_cometchat_screens-e440222e39a53f32c3bb745c9ff64d2e.png?fit=max&auto=format&n=NN4EdpOU3viwWMb_&q=85&s=b5bb05cc2275d1f51c06c4af4ebb7599" alt="Image" width="4498" height="3120" data-path="images/0796f7b5-reactions_cometchat_screens-e440222e39a53f32c3bb745c9ff64d2e.png" />
  </Tab>
</Tabs>

List of properties exposed by ReactionsStyle

| 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;\` |
| **emojiFont**              | Used to set the Emoji Font                         | `emojiFont?: FontStyle`                 |           |
| **countColor**             | Used to set the reactions count color              | `countColor?: string;`                  |           |
| **countFont**              | Used to set the reactions count font               | `countFont?: FontStyle;`                |           |
| **primaryBackgroundColor** | Used to set the reactions primary background color | `primaryBorder?: BorderStyleInterface;` |           |
| **primaryBorder**          | Used to set the primary border                     | `reactionBackground?: string;`          |           |

***

### 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="App.tsx">
    ```tsx App.tsx theme={null}
    import React from "react";
    import { CometChat } from "@cometchat/chat-sdk-react-native";
    import {
      CometChatMessages,
      CometChatReactions,
    } from "@cometchat/chat-uikit-react-native";

    function App(): React.JSX.Element {
      const [chatUser, setChatUser] = React.useState<CometChat.User | undefined>();
      const [message, setMessage] = React.useState<
        CometChat.TextMessage | undefined
      >(undefined);

      React.useEffect(() => {
        CometChat.getUser("uid").then((user) => {
          setChatUser(user);
        });
        CometChat.getMessageDetails(messageId).then((message: any) => {
          setMessage(message);
        });
      }, []);

      return (
        <>
          {message && (
            <CometChatReactions
              messageObject={message}
              alignment={"right"}
            ></CometChatReactions>
          )}
        </>
      );
    }
    ```
  </Tab>
</Tabs>

***

Below is a customizations list along with corresponding code snippets

| Property                                                | Description                                                                                     | Code                |
| ------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ------------------- |
| **alignment** <Tooltip tip="Not available">🛑</Tooltip> | Used to set the allignment of the reactions. it can be either **left**, **right** or **center** | `alignment="right"` |
