LLChatMessageMenu

LLChatMessageMenu

LLChatMessageMenu is rendered as a popover component. The default user action to show LLChatMessageMenu component is long press on message item. It consists of moderation based menu options like:

  • Report message
  • Block profile
  • Delete message

Example usage:
import React from 'react';
import {
  LLChat,
  LLChatMessageItem,
  LLChatMessageItemProps,
  LLChatMessageList,
  LLChatMessageListProps,
  LLChatMessageMenu,
  LLChatMessageMenuOption,
  LLChatMessageMenuOptionProps,
  LLChatMessageMenuOptionStyles,
  LLChatMessageMenuProps,
  LLChatMessageMenuStyles,
} from '@livelike/react-native';
import { StyleSheet } from 'react-native';

function MyMessageMenuOption<OnClickApiFnResponseData extends Promise<any>>(
  props: LLChatMessageMenuOptionProps<OnClickApiFnResponseData>
) {
  return <LLChatMessageMenuOption {...props} styles={messageMenuItemStyle} />;
}

function MyMessageMenu(props: LLChatMessageMenuProps) {
  return <LLChatMessageMenu {...props} styles={messageMenuStyle} />;
}

function MyMessageItemComponent(props: LLChatMessageItemProps) {
  return (
    <LLChatMessageItem
      {...props}
      MessageItemMenuComponent={MyMessageMenu}
      MessageItemMenuOptionComponent={MyMessageMenuOption}
    />
  );
}

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

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

const messageMenuStyle: Partial<LLChatMessageMenuStyles> = StyleSheet.create({
  menuContainer: { padding: 10 },
});
const messageMenuItemStyle: Partial<LLChatMessageMenuOptionStyles> =
  StyleSheet.create({
    menuItemIcon: { height: 20, width: 20 },
    menuItemText: { fontSize: 12 },
  });

Hooks used by LLChatMessageMenu

LLChatMessageMenu Props

visible

TypeDefault
boolean (Required)false

`children'

TypeDefault
React ElementLLChatMessageMenuOption

`styles'

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

Styles Props

CSS ClassTypeDescription
menuContainerViewStyleRoot menu container

LLChatMessageMenuOption

LLChatMessageMenuOption represents a single LLChatMessageMenu item

Hooks used by LLChatMessageMenuOption

LLChatMessageMenuOption Props

icon

TypeDefault
image source (Required)No Default

textDesc

TypeDefault
String (Required)No Default

divider

TypeDefault
Object of type: { top: boolean; bottom: boolean; }Empty Object

onClickApiFn

Type
Function of type: () => OnClickApiFnResponseData

`styles'

TypeDefualt
StyleSheet of type LLChatMessageMenuOptionStylesNo Default, if present styles props would be applied on top of internal LLChatMessageMenuOption styles.

Styles Props

CSS ClassTypeDescription
menuItemViewStyleMenu item container
menuItemTextTextStyleText styles of the menu item
menuItemIconImageStyleMenu item icon styles
menuItemTopDividerViewStyleMenu item top divider
menuItemBottomDividerViewStyleMenu item bottom divider