UNPKG

@qte/react-native-gifted-chat

Version:

Performant fork of react-native-gifted-chat with FlashList support

121 lines (120 loc) 5.57 kB
import React, { RefObject } from 'react'; import { ActionSheetOptions } from '@expo/react-native-action-sheet'; import { TextInput, StyleProp, TextStyle, ViewStyle, NativeSyntheticEvent, NativeScrollEvent } from 'react-native'; import { LightboxProps } from 'react-native-lightbox-v2'; import { ActionsProps } from '../Actions'; import { AvatarProps } from '../Avatar'; import { ComposerProps } from '../Composer'; import { DayProps } from '../Day'; import { InputToolbarProps } from '../InputToolbar'; import { LoadEarlierProps } from '../LoadEarlier'; import { MessageProps } from '../Message'; import { MessageImageProps } from '../MessageImage'; import { MessageTextProps } from '../MessageText'; import { IMessage, LeftRightStyle, MessageAudioProps, MessageVideoProps, Reply, User } from '../types'; import { QuickRepliesProps } from '../QuickReplies'; import { SendProps } from '../Send'; import { SystemMessageProps } from '../SystemMessage'; import { TimeProps } from '../Time'; import MessageContainer, { ListViewProps } from '../MessageContainer'; import Bubble from '../Bubble'; import { FlashListRef } from '@shopify/flash-list'; export interface GiftedChatProps<TMessage extends IMessage = IMessage> extends Partial<Omit<typeof MessageContainer<TMessage>, 'isScrollToBottomEnabled'>> { messageContainerRef?: RefObject<FlashListRef<TMessage> | null>; textInputRef?: RefObject<TextInput>; messages?: TMessage[]; isTyping?: boolean; renderUsernameOnMessage?: boolean; messagesContainerStyle?: StyleProp<ViewStyle>; text?: string; alignTop?: boolean; isScrollToBottomEnabled?: boolean; scrollToBottomStyle?: StyleProp<ViewStyle>; initialText?: string; placeholder?: string; disableComposer?: boolean; user?: User; locale?: string; timeFormat?: string; dateFormat?: string; dateFormatCalendar?: object; loadEarlier?: boolean; isLoadingEarlier?: boolean; isKeyboardInternallyHandled?: boolean; showUserAvatar?: boolean; showAvatarForEveryMessage?: boolean; renderAvatarOnTop?: boolean; inverted?: boolean; imageProps?: MessageImageProps<TMessage>; lightboxProps?: LightboxProps; bottomOffset?: number; focusOnInputWhenOpeningKeyboard?: boolean; minInputToolbarHeight?: number; listViewProps?: ListViewProps; textInputProps?: object; keyboardShouldPersistTaps?: 'always' | 'never' | 'handled'; maxInputLength?: number; alwaysShowSend?: boolean; imageStyle?: StyleProp<ViewStyle>; extraData?: object; minComposerHeight?: number; maxComposerHeight?: number; options?: { [key: string]: () => void; }; optionTintColor?: string; quickReplyStyle?: StyleProp<ViewStyle>; quickReplyTextStyle?: StyleProp<TextStyle>; quickReplyContainerStyle?: StyleProp<ViewStyle>; isCustomViewBottom?: boolean; infiniteScroll?: boolean; timeTextStyle?: LeftRightStyle<TextStyle>; dayAnimated?: boolean; 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; onLoadEarlier?(): void; renderLoading?(): React.ReactNode; renderLoadEarlier?(props: LoadEarlierProps): React.ReactNode; renderAvatar?: null | ((props: AvatarProps<TMessage>) => React.ReactNode); renderBubble?(props: Bubble<TMessage>['props']): React.ReactNode; renderSystemMessage?(props: SystemMessageProps<TMessage>): React.ReactNode; onPress?(context: unknown, message: TMessage): void; onLongPress?(context: unknown, message: TMessage): void; renderUsername?(user: User): React.ReactNode; renderMessage?(message: MessageProps<TMessage>): React.ReactElement; 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: Bubble<TMessage>['props']): React.ReactNode; renderDay?(props: DayProps): React.ReactNode; renderTime?(props: TimeProps<TMessage>): React.ReactNode; renderFooter?(): React.ReactNode; renderChatEmpty?(): React.ReactNode; renderChatFooter?(): React.ReactNode; renderInputToolbar?(props: InputToolbarProps<TMessage>): React.ReactNode; renderComposer?(props: ComposerProps): React.ReactNode; renderActions?(props: ActionsProps): React.ReactNode; renderSend?(props: SendProps<TMessage>): React.ReactNode; renderAccessory?(props: InputToolbarProps<TMessage>): React.ReactNode; onPressActionButton?(): void; onInputTextChanged?(text: string): void; parsePatterns?: (linkStyle?: TextStyle) => { type?: string; pattern?: RegExp; style?: StyleProp<TextStyle> | object; onPress?: unknown; renderText?: unknown; }[]; onQuickReply?(replies: Reply[]): void; renderQuickReplies?(quickReplies: QuickRepliesProps<TMessage>): React.ReactNode; renderQuickReplySend?(): React.ReactNode; scrollToBottomComponent?(): React.ReactNode; shouldUpdateMessage?(props: MessageProps<TMessage>, nextProps: MessageProps<TMessage>): boolean; handleOnScroll?(event: NativeSyntheticEvent<NativeScrollEvent>): void; }