ReactionListTop

ReactionListTop displays reactions above a message. This is the default component for the ReactionListTop prop.

Best Practices

  • Keep reaction lists compact to avoid covering message content.
  • Use supportedReactions to keep available reactions consistent.
  • Avoid heavy logic in press handlers for smooth interactions.
  • Keep reaction sizes consistent across the app.

Basic Usage

Use case: Wrap or customize the reaction list rendered above the message bubble.

import {
  WithComponents,
  ReactionListTop,
  ReactionListTopProps,
} from "stream-chat-react-native";

const CustomReactionListTop = (props: ReactionListTopProps) => (
  <ReactionListTop {...props} />
);

<WithComponents overrides={{ ReactionListTop: CustomReactionListTop }}>
  <Channel channel={channel}>
    <MessageList />
    <MessageComposer />
  </Channel>
</WithComponents>;

To restyle the reaction list container (including its background), use the messageItemView.reactionListTop.container theme key.

Props

PropDescriptionType
alignmentSets whether the message aligns left or right in the list. Defaults to 'right'.enum('right', 'left')
handleReactionHandles a reaction on a message. Called when a user reacts; should update the message and context.(reactionType: string) => Promise<void>
hasReactionsTrue if the message has at least one reaction.boolean
onLongPressDefault long press handler for message UI.function
onPressDefault press handler for message UI.function
onPressInDefault pressIn handler for message UI.function
preventPressDisable press interactions for the reaction list.boolean
reactionsReactions added to the message.array
reactionListTypeDefault layout style used for the reaction list, sourced from MessagesContext.'clustered' | 'segmented'
showCountWhether to show the count next to each reaction. Defaults to true.boolean
showReactionsOverlayOpens the reactions overlay.(selectedReaction?: string) => void
supportedReactionsList of reactions users can add to messages. See customizing reactions. Defaults to reactionData.array
typeLayout of the reaction list. 'clustered' renders a clustered list; otherwise a horizontal segmented list is used.'clustered' | 'segmented'

Examples

Reactions data structure:

[
  {
    own: true,
    type: "love",
  },
  {
    own: false,
    type: "haha",
  },
];