Chat UIKit iOS UIKit v2
Chat UIKit iOS UIKit
Chat UIKit
iOS UIKit
Version 2
Sendbird Chat UIKit v2 for iOS UIKit is no longer supported as a new version is released. Check out our latest Chat UIKit v3

Reactions

Copy link

In a group channel with multiple users, reactions become especially useful as a social interaction tool for uninterrupted engagement while chatting. Sendbird UIKit also supports the reactions feature in the framework. UIKit reactions, which are based on the Sendbird Chat SDK’s reactions feature, provide a default emoji set to suit diverse messaging needs. You can also customize the reactions UI just like the global themes.

Note: Currently, UIKit reactions are only available for group channels. Reactions are not supported for open channels and custom message types different from those provided by UIKit.


Implementation guide for reactions

Copy link

Once a client app is connected with Sendbird server, the predefined emoji list can be accessed. A combination of the emoji list and reaction information contained within each message completes the look of the reactions UI.

In order to implement reactions, 2 settings need to be checked beforehand.

  • The application settings for reactions
  • The emojis registered in the application

Components

Copy link

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 emoji reaction

Emoji reaction bar in Message menu

Copy link

When a message does not contain any prior reaction data, the only means to add a reaction is by long pressing a message to view the Emoji reaction bar in the Message menu. The bar reveals a list of 5 to 6 emojis for user convenience in the chronological order of when each emoji was registered to Sendbird server. Tapping on 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 press 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.

Add reaction button

Copy link

Add reaction button can be accessed either in the Emoji reaction box or on the Emoji reaction bar in the Message menu.

A long tap on a message can pop up the Emoji reaction bar where the Add reaction button appears. Meanwhile, a short tap on the button in the Emoji reaction box fires an onClick() event that then calls the Emoji list.

Emoji list

Copy link

Emoji list displays all emojis registered within an application. By default, UIKit provides 7 emojis and the list can be extended when you register more emojis through Chat Platform API. The Emoji list is refreshed when the application connects to the core SDK by comparing the prior emojiHash in the application to the emojiHash info from Sendbird server.

When the Emoji list is unfolded, emoji reactions already added to a message by the current user are indicated with a highlighted background color.

Emoji reaction box

Copy link

When a text or file message contains reaction data, this data is displayed below the message in the form of emoji reactions. The count of users who have added the emoji reaction to the message is also marked right next to each emoji reaction.

Tapping an emoji in the Emoji reaction box adds or removes the reacted user count.

Reacted user list

Copy link

This list can be accessed by long pressing a reaction already displayed in an Emoji reaction box. The emoji reaction pressed is shown on a tab underlined, along with all the other reactions that were added to this message. In each tab, a list of users who have contributed to the user count is displayed.


Customize the reactions UI

Copy link

You can customize the reactions UI through the new methods added to the SBUChannelViewController class.

List of methods

Copy link
MethodDescription

setReaction(message:emojiKey:didSelect:)

Adds or removes an emoji reaction.

setTapEmojiGestureHandler(cell:emojiKey:)

(Deprecated. Use setEmojiTapGestureHandler(_:emojiKey:) instead.)
Overrides this method to handle a tap gesture on the emoji in the cell.

setEmojiTapGestureHandler(_:emojiKey:)

Overrides this method to handle a tap gesture on the emoji in the cell.

setLongTapEmojiGestureHandler(cell:emojiKey:)

(Deprecated. Use setEmojiLongTapGestureHandler(_:emojiKey:) instead.)
Overrides this method to handle a long tap gesture on the emoji in the cell.

setEmojiLongTapGestureHandler(_:emojiKey:)

Overrides this method to handle a long tap gesture on the emoji in the cell.

showEmojiListModal(message:)

Override this method to show the emoji list using a customized ViewController.

SBUComponentTheme

Copy link
CategoryPropertyDescription

Emoji reaction box

reactionBoxBackgroundColor

The background color of the Emoji reaction box.

Emoji reaction box

reactionBoxBorderLineColor

The color of the border line of the Emoji reaction box.

Emoji reaction box

reactionBoxEmojiCountColor

The text color of the emoji reaction count in the Emoji reaction box.

Emoji reaction box

reactionBoxEmojiBackgroundColor

The background color of an emoji reaction in the Emoji reaction box.

Emoji reaction box

reactionBoxSelectedEmojiBackgroundColor

The highlight color for the background of the emoji reaction selected by the current user in the Emoji reaction box.

Emoji reaction box

reactionBoxEmojiCountFont

The font of the emoji reaction count in the Emoji reaction box.

Reacted user list

emojiCountColor

The text color of an emoji reaction count in the Reacted user list.

Reacted user list

emojiSelectedCountColor

The text color of the count of an emoji reaction selected by the current user in the Reacted user list.

Reacted user list

emojiSelectedUnderlineColor

The color of the underline for a selected emoji reaction tab in the Reacted user list.

Reacted user list

emojiCountFont

The font of the count of an emoji reaction selected by the current user in the Reacted user list.

Reacted user list

reactionMenuLineColor

The color of the separation line between an emoji reaction tab and its reacted user list.

Emoji list

emojiListSelectedBackgroundColor

The color for the background of emojis selected by the current user in the Emoji list.

Add reaction button

addReactionTintColor

The color of drawing in the Add reaction button located in the Emoji reaction box and on the Emoji reaction bar.