ChannelAvatar

Renders a channel avatar inside ChannelList.

Best Practices

  • Keep avatar rendering lightweight to avoid list performance issues.
  • Use ChannelPreviewAvatar to wrap interactions without altering ChannelAvatar internals.
  • Ensure touch targets are accessible when adding custom onPress.
  • Use ImageComponent from useComponentsContext() for consistent image handling.
  • Avoid inline handlers when rendering large lists; memoize where possible.

General Usage

Customize it and pass it via ChannelPreviewAvatar on ChannelList.

Example with an onPress handler:

import { TouchableOpacity } from "react-native-gesture-handler";
import {
  ChannelList,
  ChannelAvatar,
  WithComponents,
} from "stream-chat-react-native";

const CustomPreviewAvatar = ({ channel }) => (
  <TouchableOpacity
    disallowInterruption={true}
    onPress={() => {
      /** Handler for press action */
    }}
  >
    <ChannelAvatar channel={channel} />
  </TouchableOpacity>
);

<WithComponents overrides={{ ChannelPreviewAvatar: CustomPreviewAvatar }}>
  <ChannelList />
</WithComponents>;

Props

PropDescriptionType
channelChannel instance from the Stream Chat client.Channel
showOnlineIndicatorIndicates if the online indicator should be shown. Defaults to true.boolean
sizeSize of the avatar. Defaults to xl.lg | xl | 2xl
showBorderIndicates if the border should be shown. Defaults to true.boolean