import { useVirtualizedMessageListContext } from "stream-chat-react";
const CustomComponent = () => {
const { scrollToBottom } = useVirtualizedMessageListContext();
return <button onClick={scrollToBottom}>Jump to bottom</button>;
};VirtualizedMessageListContext
VirtualizedMessageListContext is provided by VirtualizedMessageListContextProvider, which wraps the content rendered by VirtualizedMessageList.
It exposes the minimal list-level API that virtualized custom components typically need.
Best Practices
- Use the context helper instead of trying to control the virtualized list DOM directly.
- Keep custom controls lightweight to avoid virtualization jitter.
- Use
scrollToBottom()for “jump to latest” style controls rendered inside the virtualized subtree. - Avoid assumptions about off-screen DOM nodes because virtualization unmounts them.
- Keep unread and notification logic separate from per-item rendering.
Basic Usage
Values
| Value | Description | Type |
|---|---|---|
scrollToBottom | Scrolls the current virtualized list to the bottom. | () => void |