PinnedMessageList

A searchable, paginated list of a channel's pinned messages. It fetches the pinned messages, renders them in a FlatList with infinite scroll, and shows an empty state when there are none. Needs to be wrapped in a ChannelDetailsContextProvider that supplies the channel.

This is the list surfaced by the navigation section of ChannelDetails. You can render it on its own screen as well.

PinnedMessageList

Best Practices

  • Wrap it in ChannelDetailsContextProvider so it can resolve the channel to query.
  • Use additionalFlatListProps to tune scrolling and performance instead of wrapping the list.
  • Pass formatMessageDate through the item when you need a custom date format in the preview.
  • Override and configure the PinnedMessageItem building block by wrapping the list in WithComponents with an overrides map.

General Usage

import {
  OverlayProvider,
  Chat,
  ChannelDetailsContextProvider,
  PinnedMessageList,
} from "stream-chat-react-native";

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

Props

PropDescriptionType
additionalFlatListPropsOverride the underlying FlatList props of the list.Partial<FlatListProps<MessageResponse>>
searchInputPropsAdditional props forwarded to the search input.SearchInputProps
searchSourceA custom MessageSearchSource used to query and paginate the pinned messages. Overrides the source created by default (pre-configured to fetch pinned messages).MessageSearchSource

Building blocks

PinnedMessageItem

The row rendered for each pinned message.

PropDescriptionType
channel *The channel the pinned message belongs to.Channel
message *The pinned message to render.MessageResponse
formatMessageDateOptional function to format the message date in the preview.(date: Date) => string