MessageList

MessageList uses FlatList to render channel messages. It must be rendered inside Channel and uses message.type to pick the appropriate message view.

Best Practices

  • Keep MessageList inside Channel so context and pagination work correctly.
  • Avoid heavy custom render logic per row; memoize where possible.
  • Use setFlatListRef instead of additionalFlatListProps for refs.
  • Toggle isLiveStreaming for high-traffic channels to improve performance.
  • Be mindful of grouping/avatars if you disable noGroupByUser.

General Usage

import {
  Chat,
  Channel,
  OverlayProvider,
  MessageList,
} from "stream-chat-react-native";

const App = () => {
  return (
    <OverlayProvider>
      <Chat client={client}>
        <Channel channel={channel}>
          <MessageList />
        </Channel>
      </Chat>
    </OverlayProvider>
  );
};

Props

PropDescriptionType
additionalFlatListPropsSet additional props on the underlying FlatList. Do not use this to access the FlatList ref; use setFlatListRef instead.object | undefined
invertedSets the inverted prop on underlying FlatList. Defaults to true.boolean | undefined
isListActiveWhether the list is active. Derived from isChannelActive in ChannelContext. Defaults to false.boolean | undefined
noGroupByUserWhen true, consecutive messages from the same user are not grouped. The avatar shows only on the last message in the group. Defaults to false.boolean | undefined
onListScrollCalled when the list scrolls. Receives the underlying FlatList scroll event.function | undefined
onThreadSelectCalled when the user selects a thread reply action or taps MessageReplies. Use it to navigate to the thread screen.function | undefined
setFlatListRefAccess the underlying FlatList ref.function | undefined
threadListWhether messages are part of a thread. Defaults to false.boolean | undefined
isLiveStreamingEnables internal MessageList optimizations for live-streaming. Available since version 8.6.2 of the SDK. Defaults to false.boolean | undefined

UI Component Overrides

The UI components used by MessageList are read from ComponentsContext and can be customized via WithComponents. Wrap MessageList (or any ancestor) with WithComponents and pass the components you want to override.

import { WithComponents } from "stream-chat-react-native";

<WithComponents
  overrides={{
    ScrollToBottomButton: CustomScrollToBottom,
    DateHeader: CustomDateHeader,
  }}
>
  <Channel channel={channel}>
    <MessageList />
    <MessageComposer />
  </Channel>
</WithComponents>;

The following components can be overridden:

FooterComponent

Footer component. Because the list is inverted, this renders at the top. Defaults to an inline loading indicator while loading more.

TypeDefault
ComponentType | undefinedInlineLoadingMoreIndicator

HeaderComponent

Header component. Because the list is inverted, this renders at the bottom. Defaults to an inline loading indicator while loading more recent messages.

TypeDefault
ComponentType | undefinedInlineLoadingMoreRecentIndicator

ScrollToBottomButton

Renders the scroll-to-bottom button when the list isn't at the latest message.

TypeDefault
ComponentTypeScrollToBottomButton

TypingIndicator

Renders the typing indicator inside MessageList.

TypeDefault
ComponentTypeTypingIndicator

DateHeader

Renders the sticky date header inside MessageList.

TypeDefault
ComponentTypeDateHeader

Examples

Setting additional FlatList props

const flatListProps = { bounces: true };

<MessageList additionalFlatListProps={flatListProps} />;

Accessing the FlatList ref

const flRef = useRef();

<MessageList setFlatListRef={(ref) => (flRef.current = ref)} />;