stream-chat-react
Version:
React components to create chat conversations or livestream style chat
68 lines • 3.42 kB
TypeScript
import React from 'react';
import type { ComponentContextValue } from '../../context/ComponentContext';
import type { LocalMessage, Message, SendMessageOptions } from 'stream-chat';
import type { CustomAudioRecordingConfig } from '../MediaRecorder';
export type EmojiSearchIndexResult = {
id: string;
name: string;
skins: Array<{
native: string;
}>;
emoticons?: Array<string>;
native?: string;
};
export interface EmojiSearchIndex {
search: (query: string) => PromiseLike<Array<EmojiSearchIndexResult>> | Array<EmojiSearchIndexResult> | null;
}
export type MessageComposerProps = {
/**
* Additional props to be passed to the underlying `AutoCompleteTextarea` component.
* Default value is handled via MessageComposer.
* [Available props](https://www.npmjs.com/package/react-textarea-autosize)
*/
additionalTextareaProps?: Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'defaultValue' | 'style' | 'disabled' | 'value'>;
/**
* When enabled, recorded messages won’t be sent immediately.
* Instead, they will “stack up” with other attachments in the message composer allowing the user to send multiple attachments as part of the same message.
*/
asyncMessagesMultiSendEnabled?: boolean;
/** Allows to configure the audio recording parameters for voice messages. */
audioRecordingConfig?: CustomAudioRecordingConfig;
/** Controls whether the users will be provided with the UI to record voice messages. */
audioRecordingEnabled?: boolean;
/** Mechanism to be used with autocomplete and text replace features of the `MessageComposer` component, see [emoji-mart `SearchIndex`](https://github.com/missive/emoji-mart#%EF%B8%8F%EF%B8%8F-headless-search) */
emojiSearchIndex?: ComponentContextValue['emojiSearchIndex'];
/** If true, focuses the text input on component mount */
focus?: boolean;
hideSendButton?: boolean;
/** Max number of rows the underlying `textarea` component is allowed to grow */
maxRows?: number;
/** Min number of rows the underlying `textarea` will start with. The `grow` on MessageComposer prop has to be enabled for `minRows` to take effect. */
minRows?: number;
/** Function to override the default message sending process. Not message updating process. */
overrideSubmitHandler?: (params: {
cid: string;
localMessage: LocalMessage;
message: Message;
sendOptions: SendMessageOptions;
}) => Promise<void> | void;
/** When replying in a thread, the parent message object */
parent?: LocalMessage;
/**
* Currently, `Enter` is the default submission key and `Shift`+`Enter` is the default combination for the new line.
* If specified, this function overrides the default behavior specified previously.
*
* Example of default behavior:
* ```tsx
* const defaultShouldSubmit = (event) => event.key === "Enter" && !event.shiftKey;
* ```
*/
shouldSubmit?: (event: React.KeyboardEvent<HTMLTextAreaElement>) => boolean;
};
declare const UnMemoizedMessageComposer: (props: MessageComposerProps) => import("react/jsx-runtime").JSX.Element;
/**
* A high level component that has provides all functionality to the Input it renders.
*/
export declare const MessageComposer: typeof UnMemoizedMessageComposer;
export {};
//# sourceMappingURL=MessageComposer.d.ts.map