react-native-gifted-chat
Version:
The most complete chat UI for React Native
90 lines • 4.81 kB
TypeScript
import React, { RefObject } from 'react';
import { TextInput, StyleProp, TextStyle, ViewStyle } from 'react-native';
import { ActionSheetOptions } from '@expo/react-native-action-sheet';
import { KeyboardProvider, KeyboardAvoidingViewProps } from 'react-native-keyboard-controller';
import { ActionsProps } from '../Actions';
import { AvatarProps } from '../Avatar';
import { BubbleProps } from '../Bubble';
import { ComposerProps } from '../Composer';
import { InputToolbarProps } from '../InputToolbar';
import { MessageImageProps } from '../MessageImage';
import { AnimatedList, MessagesContainerProps } from '../MessagesContainer';
import { MessageTextProps } from '../MessageText';
import { IMessage, LeftRightStyle, MessageAudioProps, MessageVideoProps, User } from '../Models';
import { QuickRepliesProps } from '../QuickReplies';
import { ReplyProps } from '../Reply';
import { SendProps } from '../Send';
import { SystemMessageProps } from '../SystemMessage';
import { TimeProps } from '../Time';
export interface GiftedChatProps<TMessage extends IMessage> extends Partial<Omit<MessagesContainerProps<TMessage>, 'messageReplyContainerStyle'>> {
messagesContainerRef?: RefObject<AnimatedList<TMessage>>;
textInputRef?: RefObject<TextInput>;
isUsernameVisible?: boolean;
messagesContainerStyle?: StyleProp<ViewStyle>;
text?: string;
initialText?: string;
user?: User;
locale?: string;
colorScheme?: 'light' | 'dark';
timeFormat?: string;
dateFormat?: string;
dateFormatCalendar?: object;
isUserAvatarVisible?: boolean;
isAvatarVisibleForEveryMessage?: boolean;
isAvatarOnTop?: boolean;
imageProps?: MessageImageProps<TMessage>;
minInputToolbarHeight?: number;
textInputProps?: Partial<React.ComponentProps<typeof TextInput>>;
isSendButtonAlwaysVisible?: boolean;
imageStyle?: StyleProp<ViewStyle>;
minComposerHeight?: number;
maxComposerHeight?: number;
actions?: Array<{
title: string;
action: () => void;
}>;
actionSheetOptionTintColor?: string;
quickReplyStyle?: StyleProp<ViewStyle>;
quickReplyTextStyle?: StyleProp<TextStyle>;
quickReplyContainerStyle?: StyleProp<ViewStyle>;
isCustomViewBottom?: boolean;
timeTextStyle?: LeftRightStyle<TextStyle>;
actionSheet?: () => {
showActionSheetWithOptions: (options: ActionSheetOptions, callback: (buttonIndex: number) => void | Promise<void>) => void;
};
onPressAvatar?: (user: User) => void;
onLongPressAvatar?: (user: User) => void;
messageIdGenerator?: (message?: TMessage) => string;
onSend?: (messages: TMessage[]) => void;
renderLoading?: () => React.ReactNode;
renderAvatar?: null | ((props: AvatarProps<TMessage>) => React.ReactNode);
renderBubble?: (props: BubbleProps<TMessage>) => React.ReactNode;
renderSystemMessage?: (props: SystemMessageProps<TMessage>) => React.ReactNode;
onPressMessage?: (context: unknown, message: TMessage) => void;
onLongPressMessage?: (context: unknown, message: TMessage) => void;
renderUsername?: (user: User) => React.ReactNode;
renderMessageText?: (messageText: MessageTextProps<TMessage>) => React.ReactNode;
renderMessageImage?: (props: MessageImageProps<TMessage>) => React.ReactNode;
renderMessageVideo?: (props: MessageVideoProps<TMessage>) => React.ReactNode;
renderMessageAudio?: (props: MessageAudioProps<TMessage>) => React.ReactNode;
renderCustomView?: (props: BubbleProps<TMessage>) => React.ReactNode;
renderTime?: (props: TimeProps<TMessage>) => React.ReactNode;
renderChatFooter?: () => React.ReactNode;
renderInputToolbar?: React.ComponentType<InputToolbarProps<TMessage>> | React.ReactElement | ((props: InputToolbarProps<TMessage>) => React.ReactNode) | null;
renderComposer?: (props: ComposerProps) => React.ReactNode;
renderActions?: (props: ActionsProps) => React.ReactNode;
renderSend?: (props: SendProps<TMessage>) => React.ReactNode;
renderAccessory?: (props: InputToolbarProps<TMessage>) => React.ReactNode;
onPressActionButton?: () => void;
messageTextProps?: Partial<MessageTextProps<TMessage>>;
renderQuickReplies?: (quickReplies: QuickRepliesProps<TMessage>) => React.ReactNode;
renderQuickReplySend?: () => React.ReactNode;
keyboardProviderProps?: React.ComponentProps<typeof KeyboardProvider>;
/** Props for KeyboardAvoidingView. Use `keyboardVerticalOffset` to account for headers or iOS predictive text bar (~44pt). */
keyboardAvoidingViewProps?: KeyboardAvoidingViewProps;
/** Enable animated day label that appears on scroll; default is true */
isDayAnimationEnabled?: boolean;
/** Reply functionality configuration */
reply?: ReplyProps<TMessage>;
}
//# sourceMappingURL=types.d.ts.map