stream-chat-react
Version:
React components to create chat conversations or livestream style chat
31 lines (30 loc) • 1.17 kB
TypeScript
import type { Dispatch, PropsWithChildren, SetStateAction } from 'react';
import React from 'react';
import type { Channel } from 'stream-chat';
export type ChannelListContextValue = {
/**
* State representing the array of loaded channels.
* Channels query is executed by default only by ChannelList component in the SDK.
*/
channels: Channel[];
/**
* Indicator for channel pagination to determine whether more items can be loaded
*/
hasNextPage: boolean;
/**
* Pagination function to load more channels
*/
loadNextPage(): Promise<void>;
/**
* Sets the list of Channel objects to be rendered by ChannelList component.
*/
setChannels: Dispatch<SetStateAction<Channel[]>>;
};
export declare const ChannelListContext: React.Context<ChannelListContextValue | undefined>;
/**
* Context provider for components rendered within the `ChannelList`
*/
export declare const ChannelListContextProvider: ({ children, value, }: PropsWithChildren<{
value: ChannelListContextValue;
}>) => React.JSX.Element;
export declare const useChannelListContext: (componentName?: string) => ChannelListContextValue;