Genesis
@beta

ThreadList

A conversation's list. See the module docs.

packages/ui/src/components/patterns/messaging/thread-list.tsx

Import
Subpath export: @marktiderman/genesis-ui/patterns
import { ThreadList } from "@marktiderman/genesis-ui/patterns";
Components
Auto-generated from TypeScript source via react-docgen-typescript.

THREAD_AT_BOTTOM_PX

Pixels from the bottom that still count as "at the bottom".

No declared props.

ThreadList

A conversation's list. See the module docs.

PropTypeDefaultDescription
data*readonly T[]—Oldest first.
keyExtractor*(row: T) => string—A row's id. It must stay the same across refreshes (from a cache to the server).
renderItem*(row: T, info: ThreadRowInfo) => ReactNode—
announce((row: T) => string | null)—What a screen reader says when this row arrives at the bottom; null says nothing (your own message).
classNamestring—
conversationIdstring | null—Which conversation this is. A new one opens at its newest row (or `openAt`), and the held place is forgotten.
earlierLabelstring—
emptyReactNode—Shown instead of the rows when there are none.
footerReactNode—Under the last row: who is typing.
hasEarlierboolean—There are earlier rows: loads them near the top, and shows the "Load earlier" button.
headerReactNode—Above the first row, before the "Load earlier" button: what the thread is about.
jumpId((row: T) => string | null)—The id `jumpTo` names a row by, when it isn't the row's key: a message keyed by the id the client gave it and gone to by the server's id. `null` for a row that can't be gone to. `keyExtractor` by default. Pass a stable function (module scope, or `useCallback`).
jumpTostring | null—Go to this row, loading earlier pages with `onLoadUntil` until it's here. A new id, or the same one after `null`, goes again.
labelstring—The log region's name, for a screen reader. Default "Messages".
loadingboolean—The first page is loading: shows `loadingView` (a skeleton by default), and a jump waits.
loadingEarlierboolean—
loadingViewReactNode—
onAtBottomChange((atBottom: boolean) => void)—Whether the reader is at the bottom, as it changes (to show a "new messages" pill, say).
onJumpFailed((id: string) => void)—No row answers to this id once `onLoadUntil` has settled, or it failed. The reader stays where they are.
onLoadEarlier(() => void)—
onLoadUntil((id: string) => Promise<boolean>)—Load earlier pages until the row is held; resolve false when it can't be found.
openAtstring | null—Open here instead of the newest row (the first unread), on first render and for each new `conversationId`.
refRef<ThreadListHandle>—
renderEarlier((props: { loading: boolean; onPress: () => void; label: string; testID: string; }) => ReactNode)—Replaces the default "Load earlier" button.
testIDstring—