import { useContext } from "react";
import { ThreadListItemContext } from "stream-chat-react-native";
const value = useContext(ThreadListItemContext);ThreadListItemContext
ThreadListItemContext is provided by ThreadListItem. If you are not familiar with the React Context API, see the React docs.
ThreadListItemContext must be used within ThreadList because it depends on ThreadsContext.
Best Practices
- Use
useThreadListItemContextinside thread list items only. - Keep per-item rendering lightweight to preserve scroll performance.
- Use
dateStringfor consistent timestamps. - Handle
ownUnreadMessageCountas a badge, not a control. - Avoid extra API calls; use the provided
threadandparentMessage.
Basic Usage
Consume ThreadListItemContext in any child of ThreadList:
Alternatively, use the useThreadListItemContext hook.
import { useThreadListItemContext } from "stream-chat-react-native";
const value = useThreadListItemContext();Value
channel
Channel instance from the Stream Chat client.
| Type |
|---|
| Channel |
dateString
A formatted date string for the thread timestamp. Default format: HH:MM.
| Type |
|---|
| string |
lastReply
Latest reply message in the thread.
| Type |
|---|
LocalMessage |
ownUnreadMessageCount
Unread message count for the thread.
| Type |
|---|
| number |
parentMessage
Parent message of the thread.
| Type |
|---|
LocalMessage |
thread
Instance of Thread used to read more data or pass to onThreadSelect.
| Type |
|---|
| Thread |