stream-chat-react
Version:
React components to create chat conversations or livestream style chat
83 lines (82 loc) • 2.1 kB
TypeScript
import type { Channel, LocalMessage, MessageResponse, ChannelState as StreamChannelState } from 'stream-chat';
import type { ChannelState } from '../../context/ChannelStateContext';
export type ChannelStateReducerAction = {
type: 'closeThread';
} | {
type: 'clearHighlightedMessage';
} | {
channel: Channel;
type: 'copyMessagesFromChannel';
parentId?: string | null;
} | {
channel: Channel;
type: 'copyStateFromChannelOnEvent';
} | {
channel: Channel;
highlightedMessageId: string;
type: 'jumpToMessageFinished';
} | {
channel: Channel;
hasMore: boolean;
type: 'initStateFromChannel';
} | {
hasMore: boolean;
messages: LocalMessage[];
type: 'loadMoreFinished';
} | {
hasMoreNewer: boolean;
messages: LocalMessage[];
type: 'loadMoreNewerFinished';
} | {
threadHasMore: boolean;
threadMessages: Array<ReturnType<StreamChannelState['formatMessage']>>;
type: 'loadMoreThreadFinished';
} | {
channel: Channel;
message: LocalMessage;
type: 'openThread';
} | {
error: Error;
type: 'setError';
} | {
loadingMore: boolean;
type: 'setLoadingMore';
} | {
loadingMoreNewer: boolean;
type: 'setLoadingMoreNewer';
} | {
message: LocalMessage;
type: 'setThread';
} | {
channel: Channel;
type: 'setTyping';
} | {
type: 'startLoadingThread';
} | {
channel: Channel;
message: MessageResponse;
type: 'updateThreadOnEvent';
} | {
type: 'jumpToLatestMessage';
};
export declare const makeChannelReducer: () => (state: ChannelState, action: ChannelStateReducerAction) => ChannelState;
export declare const initialState: {
error: null;
hasMore: boolean;
hasMoreNewer: boolean;
loading: boolean;
loadingMore: boolean;
members: {};
messages: never[];
pinnedMessages: never[];
read: {};
suppressAutoscroll: boolean;
thread: null;
threadHasMore: boolean;
threadLoadingMore: boolean;
threadMessages: never[];
threadSuppressAutoscroll: boolean;
typing: {};
watcherCount: number;
watchers: {};
};