MessageFooter

Component to render footer of message, which consists of read receipts, timestamp of message etc. This component uses MessageStatus for rendering read receipts internally.

Basic Usage

You can customize the MessageFooter component and provide it back to the SDK via the MessageFooter prop on Channel if desired. Replacing the formattedDate function used by the MessageFooter throughout the SDK with your own is easily accomplished.

import { Channel, MessageFooter } from 'stream-chat-react-native';

const getDateTimeStamp = message => `My new date is ${message.created_at}`;

const CustomMessageFooter = ({ message }) => {
  const dateFormatted = useMemo(() => getDateTimeStamp(message), [message.created_at]);

  <MessageFooter formattedDate={dateFormatted} />;
};

<Channel MessageFooter={CustomMessageFooter} />;

Props

date

DateTime stamp to be shown in footer for deleted message.

Type
String | Date | undefined

isDeleted

Weather message is deleted or not. In case of deleted message, 'Only visible to you' subtext will be rendered in this component.

TypeDefault
Booleanfalse

alignment

Sets if the message should be aligned to right or left side of list.

TypeDefault
enum(‘right’, ‘left’)‘right’

deletedMessagesVisibilityType

Controls the visibility of the deleted messages within the channel.

  • always: The deleted messages in the channel will be visible to both the sender and receiver.
  • never: The deleted messages will not be visible to anyone.
  • sender: The deleted messages in the channel will only be visible to sender.
  • receiver: The deleted messages in the channel will only be visible to receiver.
TypeDefault
enum(‘always’, ‘never’, ‘receiver’, ‘sender’)‘both’

lastGroupMessage

Whether or not this is the last message in a group of messages.

Type
boolean

members

Members of current channel. This value is received from backend when you query a channel, either using client.queryChannels() or channel.watch() API call.

client.queryChannels() or channel.watch() returns only up to 100 members of channel. So if you expect total number of members to be > 100, its better to use client.queryMembers() API endpoint separately to get the list of members.

Record<
  string, // userId
  {
    banned?: boolean;
    created_at?: string;
    invite_accepted_at?: string;
    invite_rejected_at?: string;
    invited?: boolean;
    is_moderator?: boolean;
    role?: string;
    shadow_banned?: boolean;
    updated_at?: string;
    user?: UserResponse<UserType>;
    user_id?: string;
  }
>;
Type
object

message

Message object.

Type
Message type

otherAttachments

All the attachments on the message except for types file and image.

Type
Array

showMessageStatus

When false, message status (read receipt, pending state indicator) won’t be rendered. By default, this value is true for messages sent by current user of chat.

Type
boolean

UI Components

MessageTimestamp

The Component that renders the message timestamp.

TypeDefault
ComponentType |undefinedundefined
© Getstream.io, Inc. All Rights Reserved.