id | sidebar_position | title |
---|---|---|
channel_state_context |
2 |
ChannelStateContext |
The ChannelStateContext
is a one of the context providers exposed in the Channel
component and is consumable by all of the Channel
children components.
The context provides all the state properties and logic for a channel
, and you can access these by calling the useChannelStateContext
custom hook.
Pull values from context with our custom hook:
const { channel, watchers } = useChannelStateContext();
A list of accepted file upload types.
Type |
---|
string[] |
The currently active StreamChat
channel
instance to be loaded into the Channel
component and referenced by its children.
Type |
---|
object |
The allowed channel permissions for the currently connected user.
Type |
---|
object |
The configurations object for the currently active channel.
Type |
---|
object |
If true, chat users will be able to drag and drop file uploads to the entire channel window.
Type | Default |
---|---|
boolean | false |
Number of milliseconds to debounce firing the URL enrichment queries when typing. The default value is 1500(ms). See the guide Link Previews in Message Input for more.
Type | Default |
---|---|
number | 1500 |
A global flag to toggle the URL enrichment and link previews in MessageInput
. By default, the feature is disabled. It can be overridden on Thread and MessageList level through additionalMessageInputProps
or directly on MessageInput
level through urlEnrichmentConfig
prop.
Type | Default |
---|---|
boolean | false |
Error object (if any) in loading the channel
, otherwise null.
Type |
---|
object |
Custom function to identify URLs in a string for later generation of link previews. See the guide Link Previews in Message Input for more.
Type |
---|
(text: string) => string[] |
The giphy version to use when displaying giphies.
Type |
---|
'original' | 'fixed_height' | 'fixed_height_still' | 'fixed_height_downsampled' | 'fixed_width' | 'fixed_width_still' | 'fixed_width_downsampled' |
A custom function to provide size configuration for image attachments
Type |
---|
(a: Attachment, e: HTMLElement) => ImageAttachmentConfigration |
If the channel has more, older, messages to paginate through.
Type |
---|
boolean |
If the channel has more, newer, messages to paginate through.
Type |
---|
boolean |
Value is used internally for jump-to-message logic. Once the user "jumped" to the message, the message with the given ID is highlighted by manipulating its styles attribute.
Type |
---|
string |
Boolean for the channel
loading state.
Type |
---|
boolean |
Boolean for the channel
loading more messages.
Type |
---|
boolean |
Flag signalling whether newer messages are being loaded as the user scrolls down in the message list. Used internally by VirtualizedMessageList
.
Type |
---|
boolean |
The maximum number of attachments allowed per message
, defaults to the Stream Chat API maximum.
Type | Default |
---|---|
number | 10 |
Members of this channel
(members are permanent, watchers are users who are online right now).
Type |
---|
object[] |
Array of message objects.
Type |
---|
object[] |
Whether to allow multiple attachment uploads on a message.
Type | Default |
---|---|
boolean | true |
An array of muted users for a channel
.
Type |
---|
object[] |
Temporary notifications added to the MessageList
on specific user/message actions.
Type |
---|
{id: string, text: string, type: 'success' | 'error'}[] |
Custom function to react to link preview dismissal. See the guide Link Previews in Message Input for more.
Type |
---|
(linkPreview: LinkPreview) => void |
The read state maintained for use by components representing channel unread state (for example UnreadMessagesSeparator
, UnreadMessagesNotification
).
Property | Type | Description |
---|---|---|
last_read | Date |
Date when the channel was marked read the last time. |
unread_messages | number |
The count of unread messages in a given channel. Unread count refers only to foreign (not own) unread messages. |
first_unread_message_id | string or undefined |
The ID of the message that was marked unread (notification.mark_unread event). The value is available only when a message is marked unread. Therefore, cannot be relied on to place unread messages UI. |
last_read_message_id | string or undefined |
The ID of the message preceding the first unread message. |
Type |
---|
ChannelUnreadUiState |
The messages that are pinned in the channel
.
Type |
---|
object[] |
An inline message reply to another message.
Type |
---|
object |
The read state for each channel
member.
Type |
---|
object |
Flag signalling whether the scroll to the bottom is prevented. Used internally by MessageList
and VirtualizedMessageList
components.
Type |
---|
boolean |
You can turn on/off thumbnail generation for video attachments
Type |
---|
boolean |
The parent message for a thread
, if there is one, otherwise null.
Type |
---|
object |
Boolean showing if there are more messages available in current active thread
, set to false when the end of pagination is reached.
Type |
---|
boolean |
If the thread is currently loading more messages.
Type |
---|
boolean |
Array of messages within a thread
.
Type |
---|
object[] |
Flag signalling whether the scroll to the bottom is prevented in thread. Used internally by MessageList
and VirtualizedMessageList
components.
Type |
---|
boolean |
A custom function to provide size configuration for video attachments
Type |
---|
(a: Attachment, e: HTMLElement) => VideoAttachmentConfiguration |
The number of watchers on the channel
.
Type |
---|
number |
An array of users who are currently watching the channel
.
Type |
---|
object[] |
The number of watchers on the channel
.
Type |
---|
number |