ThreadContext

ThreadContext is provided by Channel component. If you are not familiar with React Context API, please read about it on React docs.

Basic Usage

ThreadContext can be consumed by any of the child component of Channel component as following:

import { useContext } from "react";
import { ThreadContext } from "stream-chat-react-native";

const value = useContext(ThreadContext);

Alternatively, you can also use useThreadContext hook provided by library to consume ThreadContext.

import { useThreadContext } from "stream-chat-react-native";

const value = useThreadContext();

Value

allowThreadMessagesInChannel “

Display the Show thread message in channel button inside the thread MessageInput.

TypeDefault
booleantrue

closeThread

Unsets the thread and thread messages in the Channel state.

Type
Function

loadMoreThread

Loads more messages for the thread. Returns a promise.

Type
() => Promise<void>

openThread

Sets the thread and thread messages in the Channel state.

Type
function

parentMessagePreventPress

Boolean to enable/disable parent message press.

TypeDefault
Booleantrue

reloadThread

Reloads the thread and thread messages.

Type
function

setThreadLoadingMore

A function which can be used to set the thread loading more state.

Type
function

thread

Can be either a MessageType object or a ThreadType that when set indicates a thread is open. Both of the types may be used interchangeably.

When used with the Thread component this will display the thread. When used with the standard MessageList component this will prevent any singleton components in the OverlayProvider form getting out of sync.

thread should be set on all Channel components when a thread is open.

Type
object

threadHasMore

Boolean flag for thread messages pagination.

Type
boolean

threadLoadingMore

Boolean flag for thread messages loading more state.

Type
boolean

threadMessages

A list of formatted messages objects.

| Type | | --------------- | --- | | Array<object> | |

© Getstream.io, Inc. All Rights Reserved.