Reactions
Message reactions are a useful social interaction tool that helps build a more engaging chat experience. Users can express their response to messages beyond text using emojis. The UIKit reactions feature is based on the Chat SDK’s reactions feature and provides a default set of emojis suited for diverse messaging needs. You can also customize the reactions UI just like the global themes.
Implementation guide for reactions
Once a client app is connected to the Sendbird server, you can access the predefined emoji list. A combination of the emoji list and the reaction information within each message completes the UI of the reactions.
In order to implement this feature, the following settings need to be checked:
- The application settings for reactions
- The emojis registered in your Sendbird application
Components
There are 3 ways in which reactions can be expressed by users:
- Long tap on a message to select an emoji from the Emoji reaction bar.
- Tap on the Add reaction button to select an emoji.
- Tap on an existing emoji reaction in the Emoji reaction box to add a user count of the reaction.
When a message doesn't contain any prior reaction data, the only way to add a reaction is by holding down a message to view the Emoji reaction bar in the Message menu. The bar reveals a list of five to six emojis in the chronological order of when each emoji was registered to the Sendbird server. Selecting the Add reaction button on the right end of the bar reveals the full Emoji list to add different emoji reactions.
If a message already contains reaction data, you can still long tap a message to view the Emoji reaction bar. In this case, emoji reactions already added to the message by the current user are indicated with a highlighted background color.
The Add reaction button can be accessed through either the Emoji reaction box or the Emoji reaction bar in the Message menu.
A long tap on a message can open the Emoji reaction bar where the Add reaction button appears, whereas a regular tap on the button in the Emoji reaction box sends an onClick()
event that calls the Emoji list.
Emoji list
An Emoji list displays all emojis registered within an application. By default, Sendbird UIKit provides seven emojis but you can register more through the add emojis API. The Emoji list is refreshed when the application connects to the Chat SDK by comparing the prior emojiHash
in the application to the emojiHash
information from the Sendbird server.
When the Emoji list is shown, reactions already added to a message by the current user are indicated with a highlighted background color.
Emoji reaction box
When a text or file message contains reaction data, this data is displayed below the message in the form of emoji reactions. The number of users who added an emoji reaction to the message is indicated next to each emoji reaction. Selecting an emoji in the Emoji reaction box adds or removes the reacted user count.
Reacted user list
To see a list of users who reacted to the message, long tap a reaction emoji that's displayed in the Emoji reaction box. The underlined tab corresponds to the tapped emoji reaction but you can also view the reacted user list for other emoji reactions. Each tab shows the user count and a list of all users who reacted with the emoji.
Customize the reactions UI
The UI for reactions can be customized through the color resource and icon resource.
Color resource
To customize the color and style of message items, you have to change the values of UIKitColors
in UIKitTheme
as shown below.
Category | Property | Description |
---|---|---|
reaction | background | Specifies the background color of a reaction emoji that's been selected by the current user. |
reaction | highlight | Specifies the highlight color of a reaction emoji and its user count that's selected in the reacted user list. |
Note: To learn how to customize theme colors, refer to the color resource page and the themes page.
Icon resource
The following table shows customizable reaction icons.
Icon | Image | Description |
---|---|---|
emoji-more | An icon used to add reactions. |