This is documentation for Stream Chat React Native SDK v3, which is nolonger actively maintained. For up-to-date documentation, see the latest version (v5).

MessageAvatar

Component to render the avatar of the sender (user) of a message within the MessageList.

Basic Usage

You can customize the MessageAvatar component and provide it back to the SDK via the MessageAvatar prop on Channel if desired.

Reducing the size of user avatar can be easily accomplished.

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

const SmallerMessageAvatar = () => <MessageAvatar size={30} />

<Channel MessageAvatar={SmallerMessageAvatar} />

Props

This component uses default values for all the following props, from MessageContext

alignment

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

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

lastGroupMessage

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

Type
boolean

message

Message object

Type
object

size

Dimension for avatar image.

You can also set the size for message avatar, using our theming system.

const theme = {
  avatar: {
    BASE_AVATAR_SIZE: 30,
  },
};
TypeDefault
number32
© Getstream.io, Inc. All Rights Reserved.