UNPKG

stream-chat-react

Version:

React components to create chat conversations or livestream style chat

23 lines (22 loc) 1.34 kB
import React, { Dispatch, PropsWithChildren, SetStateAction } from 'react'; import type { Channel } from 'stream-chat'; import type { DefaultStreamChatGenerics } from '../types/types'; export type ChannelListContextValue<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = { /** * State representing the array of loaded channels. * Channels query is executed by default only by ChannelList component in the SDK. */ channels: Channel<StreamChatGenerics>[]; /** * Sets the list of Channel objects to be rendered by ChannelList component. */ setChannels: Dispatch<SetStateAction<Channel<StreamChatGenerics>[]>>; }; export declare const ChannelListContext: React.Context<ChannelListContextValue<DefaultStreamChatGenerics> | undefined>; /** * Context provider for components rendered within the `ChannelList` */ export declare const ChannelListContextProvider: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ children, value, }: PropsWithChildren<{ value: ChannelListContextValue<StreamChatGenerics>; }>) => React.JSX.Element; export declare const useChannelListContext: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(componentName?: string) => ChannelListContextValue<StreamChatGenerics>;