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

additionalFlatListProps

Set additional props on the underlying FlatList.

const flatListProps = { bounces: true };

<MessageList additionalFlatListProps={flatListProps} />;

Don't use additionalFlatListProps to access the FlatList ref, use setFlatListRef instead.

Type
Object | undefined

inverted

Sets the inverted prop on underlying FlatList.

TypeDefault
Boolean | undefinedtrue

isListActive

Whether the list is active. Derived from isChannelActive in ChannelContext.

TypeDefault
Boolean| undefinedfalse

noGroupByUser

When true, consecutive messages from the same user are not grouped. The avatar shows only on the last message in the group.

TypeDefault
Boolean | undefinedfalse

onListScroll

Called when the list scrolls. Receives the underlying FlatList scroll event.

The event has the following shape (all values are numbers):

{
  nativeEvent: {
    contentInset: {bottom, left, right, top},
    contentOffset: {x, y},
    contentSize: {height, width},
    layoutMeasurement: {height, width},
    zoomScale
  }
}
Type
Function| undefined

onThreadSelect

Called when the user selects a thread reply action or taps MessageReplies. Use it to navigate to the thread screen.

Type
Function | undefined

setFlatListRef

Access the underlying FlatList ref.

Example

const flRef = useRef();

<MessageList setFlatListRef={(ref) => (flRef.current = ref)} />;
Type
Function | undefined

threadList

Whether messages are part of a thread.

TypeDefault
Boolean | undefinedfalse

isLiveStreaming

This component is available since version 8.6.2 of the SDK.

Enables internal MessageList optimizations for live-streaming.

TypeDefault
Boolean | undefinedfalse

UI Component Props

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