LLUserReactionCounts

LLUserReactionCounts

LLUserReactionCounts is rendered as a message item footer and represents the reaction picker, reactions and reaction count details

Custom implementation for MessageReactionPickerComponent and UserReactionCountDetailComponent example:
import React from 'react';
import {
  LLChat,
  LLChatMessageItem,
  LLChatMessageItemFooter,
  LLChatMessageItemFooterProps,
  LLChatMessageItemProps,
  LLChatMessageList,
  LLChatMessageListProps,
  LLReactionPickerProps,
  LLUserReactionCountDetailProps,
  LLUserReactionCounts,
  LLUserReactionCountsProps,
} from '@livelike/react-native';

function MyUserReactionsPickerComponent(props: LLReactionPickerProps) {
  // render custom reaction picker component
}

function MyUserReactionsCountDetailComponent(
  props: LLUserReactionCountDetailProps
) {
  // render custom reaction count detail component
}

function MyUserReactionsCountComponent(props: LLUserReactionCountsProps) {
  return (
    <LLUserReactionCounts
      {...props}
      MessageReactionPickerComponent={MyUserReactionsPickerComponent}
      UserReactionCountDetailComponent={MyUserReactionsCountDetailComponent}
    />
  );
}

function MyMessageItemFooter(props: LLChatMessageItemFooterProps) {
  return (
    <LLChatMessageItemFooter
      {...props}
      UserReactionsCountComponent={MyUserReactionsCountComponent}
    />
  );
}

function MyMessageItemComponent(props: LLChatMessageItemProps) {
  return (
    <LLChatMessageItem
      {...props}
      MessageItemFooterComponent={MyMessageItemFooter}
    />
  );
}

function MyMessageListComponent(props: LLChatMessageListProps) {
  return (
    <LLChatMessageList
      {...props}
      MessageItemComponent={MyMessageItemComponent}
    />
  );
}

export function MyApp() {
  return (
    <LLChat
      roomId="<Your chat room id>"
      MessageListComponent={MyMessageListComponent}
    />
  );
}
Customise styles for Stock LLReactionPicker and LLUserReactionCountDetail components example:
import React from 'react';
import {
  LLChat,
  LLChatMessageItem,
  LLChatMessageItemFooter,
  LLChatMessageItemFooterProps,
  LLChatMessageItemProps,
  LLChatMessageList,
  LLChatMessageListProps,
  LLReactionPicker,
  LLReactionPickerItemStyles,
  LLReactionPickerProps,
  LLReactionPickerStyles,
  LLUserReactionCountDetailStyles,
  LLUserReactionCounts,
  LLUserReactionCountsProps,
} from '@livelike/react-native';
import { StyleSheet } from 'react-native';

function MyUserReactionsPickerComponent(props: LLReactionPickerProps) {
  return (
    <LLReactionPicker
      {...props}
      styles={reactionPickerStyle}
      ReactionItemComponentStyles={reactionItemStyles}
    />
  );
}

function MyUserReactionsCountComponent(props: LLUserReactionCountsProps) {
  return (
    <LLUserReactionCounts
      {...props}
      MessageReactionPickerComponent={MyUserReactionsPickerComponent}
      UserReactionCountDetailComponentStyles={userReactionCountDetailStyles}
    />
  );
}

function MyMessageItemFooter(props: LLChatMessageItemFooterProps) {
  return (
    <LLChatMessageItemFooter
      {...props}
      UserReactionsCountComponent={MyUserReactionsCountComponent}
    />
  );
}

function MyMessageItemComponent(props: LLChatMessageItemProps) {
  return (
    <LLChatMessageItem
      {...props}
      MessageItemFooterComponent={MyMessageItemFooter}
    />
  );
}

function MyMessageListComponent(props: LLChatMessageListProps) {
  return (
    <LLChatMessageList
      {...props}
      MessageItemComponent={MyMessageItemComponent}
    />
  );
}

export function MyApp() {
  return (
    <LLChat
      roomId="<Your chat room id>"
      MessageListComponent={MyMessageListComponent}
    />
  );
}

const reactionPickerStyle: Partial<LLReactionPickerStyles> = StyleSheet.create({
  pickerContainer: { bottom: 0, right: 0, borderRadius: 10 },
});
const reactionItemStyles: Partial<LLReactionPickerItemStyles> =
  StyleSheet.create({
    reactionIcon: { height: 12, width: 12 },
  });
const userReactionCountDetailStyles: Partial<LLUserReactionCountDetailStyles> =
  StyleSheet.create({
    reactionCountText: { fontSize: 9 },
    reactionIcon: { height: 12, width: 12 },
  });

Hooks used by LLUserReactionCounts

LLUserReactionCounts Props

targetGroupId

TypeDefault
String (Required)No Default

targetId

TypeDefault
String (Required)No Default

showReactionPicker

TypeDefault
booleanfalse if not present

reactionsLimit

TypeDefault
Number4

onReactionItemPress

Type
Function of type: (reactionId: string) => void (Required)

UserReactionCountDetailComponent

TypeDefault
React Component of type LLUserReactionCountDetailLLUserReactionCountDetail

UserReactionCountDetailComponentStyles

TypeDefault
LLUserReactionCountDetailStylesNo Default, if present styles props would be applied on top of internal LLUserReactionCountDetail styles.

MessageReactionPickerComponent

TypeDefault
React Component of type LLReactionPickerLLReactionPicker

MessageReactionPickerComponentStyles

TypeDefault
LLUserReactionCountDetailStylesNo Default, if present styles props would be applied on top of internal LLUserReactionCountDetail styles.

styles

TypeDefault
StyleSheet of type LLUserReactionCountsStylesNo Default, if present styles props would be applied on top of internal LLUserReactionCounts styles.

Styles Props

CSS ClassTypeDescription
reactionCountsContainerViewStyleReaction counts root container
moreReactionsViewViewStyleMore reactions button container
moreReactionsTextTextStyleMore reactions button text styles

LLUserReactionCountDetail

LLUserReactionCountDetail represents a single reaction in reaction counts list

Hooks used by LLUserReactionCountDetail

LLUserReactionCountDetail Props

reaction

TypeDefault
IUserReactionCountDetail (Required)No Default

onPress

Type
Function of type: (reactionId: string) => void (Required)

styles

TypeDefault
StyleSheet of type LLUserReactionCountDetailStylesNo Default, if present styles props would be applied on top of internal LLUserReactionCountDetail styles.

Styles Props

CSS ClassTypeDescription
containerViewStyleRoot reaction container
reactionIconImageStyleReaction icon styles
reactionCountTextTextStyleReaction count text styles
selfReactionContainerViewStyleSelf reaction root container
selfReactionCountTextTextStyleSelf reaction count text styles

LLReactionPicker

LLReactionPicker renders the reaction picker when user press on add reaction icon in message item footer

Hooks used by LLReactionPicker

LLReactionPicker Props

visible

TypeDefault
booleanFalse if not present

reactionSpaceId

TypeDefault
String (Required)No Default

onPress

Type
Function of type: (reactionId: string) => void (Required)

ReactionItemComponent

TypeDefault
React Component of type LLReactionPickerItemLLReactionPickerItem

ReactionItemComponentStyles

TypeDefault
LLReactionPickerItemStylesNo Default, if present styles props would be applied on top of internal LLReactionPickerItem styles.

styles

TypeDefault
StyleSheet of type LLReactionPickerStylesNo Default, if present styles props would be applied on top of internal LLReactionPicker styles.

Styles Props

CSS ClassTypeDescription
pickerContainerViewStyleRoot reactions picker container

LLReactionPickerItem

LLReactionPickerItem renders a single reaction in reaction picker

Hooks used by LLReactionPickerItem

LLReactionPickerItem Props

reaction

TypeDefault
IReactionEmoji (Required)No Default

onPress

Type
Function of type: (id: string) => void (Required)

styles

TypeDefault
StyleSheet of type LLReactionPickerItemStylesNo Default, if present styles props would be applied on top of internal LLReactionPickerItem styles.

Styles Props

CSS ClassTypeDescription
reactionIconImageStyleReaction icon styles (in reaction picker)

What’s Next