Skip to main content
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

overrides the value from MessageContext
alignment

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

TypeDefault
enum('right', 'left')'right'

overrides the value from MessageContext
lastGroupMessage

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

Type
boolean

overrides the value from MessageContext
message

Message object.

Type
Message type

size

Dimension for avatar image.

success

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

const theme = {
avatar: {
BASE_AVATAR_SIZE: 30,
},
};
TypeDefault
Number32

UI Component Props

overrides the value from ChatContext
ImageComponent

Drop in replacement of all the underlying Image components within SDK. This is useful for the purpose of offline caching of images. Please check the Offline Support Guide for usage.

TypeDefault
ComponentTypeImage

Did you find this page helpful?