@@ -48,24 +48,56 @@ dayjs.extend(calendar)
4848export type ChatTopLevelProps = InputTopLevelProps & MessageTopLevelProps
4949
5050export interface ChatProps extends ChatTopLevelProps {
51+ /** If {@link ChatProps.dateFormat} and/or {@link ChatProps.timeFormat} is not enough to
52+ * customize date headers in your case, use this to return an arbitrary
53+ * string based on a `dateTime` of a particular message. Can be helpful to
54+ * return "Today" if `dateTime` is today. IMPORTANT: this will replace
55+ * all default date headers, so you must handle all cases yourself, like
56+ * for example today, yesterday and before. Or you can just return the same
57+ * date header for any message. */
5158 customDateHeaderText ?: ( dateTime : number ) => string
59+ /** Allows you to customize the date format. IMPORTANT: only for the date,
60+ * do not return time here. @see {@link ChatProps.timeFormat} to customize the time format.
61+ * @see {@link ChatProps.customDateHeaderText } for more customization. */
5262 dateFormat ?: string
63+ /** Disable automatic image preview on tap. */
5364 disableImageGallery ?: boolean
65+ /** Allows you to change what the user sees when there are no messages.
66+ * `emptyChatPlaceholder` and `emptyChatPlaceholderTextStyle` are ignored
67+ * in this case. */
5468 emptyState ?: ( ) => React . ReactNode
69+ /** Use this to enable `LayoutAnimation`. Experimental on Android (same as React Native). */
5570 enableAnimation ?: boolean
5671 flatListProps ?: Partial < FlatListProps < MessageType . DerivedAny [ ] > >
5772 inputProps ?: InputAdditionalProps
73+ /** Used for pagination (infinite scroll) together with {@link ChatProps.onEndReached}.
74+ * When true, indicates that there are no more pages to load and
75+ * pagination will not be triggered. */
5876 isLastPage ?: boolean
77+ /** Override the default localized copy. */
5978 l10nOverride ?: Partial < Record < keyof typeof l10n [ keyof typeof l10n ] , string > >
6079 locale ?: keyof typeof l10n
6180 messages : MessageType . Any [ ]
81+ /** Used for pagination (infinite scroll). Called when user scrolls
82+ * to the very end of the list (minus `onEndReachedThreshold`).
83+ * See {@link ChatProps.flatListProps} to set it up. */
6284 onEndReached ?: ( ) => Promise < void >
85+ /** Show user names for received messages. Useful for a group chat. Will be
86+ * shown only on text messages. */
6387 showUserNames ?: boolean
88+ /** Chat theme. Implement {@link Theme} to create your own theme or use
89+ * existing one, like the {@link defaultTheme}. */
6490 theme ?: Theme
91+ /**
92+ * Allows you to customize the time format. IMPORTANT: only for the time,
93+ * do not return date here. @see {@link ChatProps.dateFormat} to customize the date format.
94+ * @see {@link ChatProps.customDateHeaderText } for more customization.
95+ */
6596 timeFormat ?: string
6697 user : User
6798}
6899
100+ /** Entry component, represents the complete chat */
69101export const Chat = ( {
70102 customDateHeaderText,
71103 dateFormat,
0 commit comments