LLChatMessageComposer

LLChatMessageComposer is used to compose a message which could be a text message, image message in the form of stickers of gifs. As part of LLChat component this component is rendered at the bottom of the UI.
LLChatMessageComposer component in turn renders:

  • TextInput - To send a text message.
  • Sticker Picker - To pick and send sticker image. Sticker picker component is shown when clicked on sticker picker icon.
  • Gif Picker - To pick and send gif. Gif picker component is shown when clicked on gif picker icon.
2152
Custom implementation for GifPickerComponent, StickerPickerComponent and SendButtonComponent example:
import React from 'react';
import {
  LLChat,
  LLChatMessageComposer,
  LLChatMessageComposerProps,
  LLGifPickerProps,
  LLStickerPickerProps,
} from '@livelike/react-native';
import { LLComposerSendButtonProps } from '../react-native/src/components/LLChatMessageComposer/LLComposerSendButton';

function MySendButton(props: LLComposerSendButtonProps) {
  // render your custom send button
}

function MyStickerPicker(props: LLStickerPickerProps) {
  // render your custom sticker picker
}

function MyGifPicker(props: LLGifPickerProps) {
  // render your custom gif picker
}

function MyComposer(props: LLChatMessageComposerProps) {
  return (
    <LLChatMessageComposer
      {...props}
      GifPickerComponent={MyGifPicker}
      StickerPickerComponent={MyStickerPicker}
      SendButtonComponent={MySendButton}
    />
  );
}

export function MyApp() {
  return (
    <LLChat
      roomId="<Your chat room id>"
      MessageComposerComponent={MyComposer}
    />
  );
}
Customise styles for Stock LLGifPicker, LLStickerPicker and LLComposerSendButton components example:
import React from 'react';
import {
  LLChat,
  LLChatMessageComposer,
  LLChatMessageComposerProps,
  LLComposerSendButtonStyles,
  LLStickerPickerStyles,
  LLGifPickerStyles,
} from '@livelike/react-native';
import { StyleSheet } from 'react-native';

function MyComposer(props: LLChatMessageComposerProps) {
  return (
    <LLChatMessageComposer
      {...props}
      GifPickerComponentStyles={gifPickerStyles}
      StickerPickerComponentStyles={stickerPickerStyles}
      SendButtonComponentStyles={sendButtonStyles}
    />
  );
}

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

const sendButtonStyles: Partial<LLComposerSendButtonStyles> = StyleSheet.create(
  {
    buttonContainer: { backgroundColor: 'red' },
    icon: { height: 12, width: 12 },
  }
);
const stickerPickerStyles: Partial<LLStickerPickerStyles> = StyleSheet.create({
  stickerPackIcon: { height: 15, width: 15 },
  stickerImage: { height: 100, width: 100 },
  pickerCloseIcon: { marginLeft: 3 },
});
const gifPickerStyles: Partial<LLGifPickerStyles> = StyleSheet.create({
  gifImage: { height: 100, width: 100 },
  gifImageContainer: { margin: 10 },
});

Hooks used by LLChatMessageComposer

LLChatMessageComposer Props

roomId

TypeDefault
String (Required)No Default

GifPickerComponent

TypeDefault
React Component of type LLGifPickerLLGifPicker

GifPickerComponentStyles

TypeDefault
LLGifPickerStylesNo Default, if present styles props would be applied on top of internal LLGifPicker styles.

StickerPickerComponent

TypeDefault
React Component of type LLStickerPickerLLStickerPicker

StickerPickerComponentStyles

TypeDefault
LLStickerPickerStylesNo Default, if present styles props would be applied on top of internal LLStickerPicker styles.

SendButtonComponent

TypeDefault
React Component of type LLComposerSendButtonLLComposerSendButton

SendButtonComponentStyles

TypeDefault
LLComposerSendButtonStylesNo Default, if present styles props would be applied on top of internal LLComposerSendButton styles.

styles

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

Styles Props

CSS ClassTypeDescription
composerContainerViewStyleRoot composer container
composerInputViewStyleTextInput container
composerIconImageStyleComposer icon for gif and sticker pickers

LLComposerSendButton

LLComposerSendButton renders the "Send Message Button" in the LLChatMessageComposer component

Hooks used by LLComposerSendButton

LLComposerSendButton Props

isSendingMessage

TypeDefault
boolean (Required)false

disabled

TypeDefault
booleanfalse if not present

onPress

Type
Function of type: () => void

styles

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

Styles Props

CSS ClassTypeDescription
buttonContainerViewStyleSend message button container
iconImageStyleButton icon styles

What’s Next