import { useContext } from "react";
import { ThreadListItemContext } from "stream-chat-react-native";
const value = useContext(ThreadListItemContext);
ThreadListItemContext
The ThreadListItemContext
is provided by the ThreadListItem
component. If you are not familiar with React Context API, please read about it on React docs.
The ThreadListItemContext
needs to be used within the ThreadList
component as it depends on the ThreadsContext
.
Basic Usage
The ThreadListItemContext
can be consumed by any of the child components of ThreadList
component as following:
Alternatively, you can also use useThreadListItemContext
hook provided by library to consume ThreadListItemContext
.
import { useThreadListItemContext } from "stream-chat-react-native";
const value = useThreadListItemContext();
Value
channel
Channel instance from the StreamChat client.
Type |
---|
Channel |
dateString
A formatted date string that can be used as a thread timestamp. The default format is HH:MM
.
Type |
---|
string |
lastReply
A Message instance providing the latest message reply in the thread.
Type |
---|
MessageType |
ownUnreadMessageCount
A number providing the number of unread messages for the particular thread.
Type |
---|
number |
parentMessage
A Message instance providing the parent message of the thread.
Type |
---|
MessageType |
thread
An instance of the Thread
class that can be used to either get more data about the thread or pass to onThreadSelect
.
Type |
---|
Thread |