import { Message } from '@ably/chat'; import React from 'react'; export interface ChatMessageListProps extends Omit, 'children'> { /** * Array of Ably Chat Message objects to render in chronological order. * Each message contains content, metadata, reactions, and status information. */ messages: Message[]; /** * Optional callback triggered when user scrolls near the top of the message list. * Called automatically when scroll position is within loadMoreThreshold pixels from top. * Use this to fetch and prepend older messages to the messages array. */ onLoadMoreHistory?: () => void; /** * Whether a history loading operation is currently in progress. * When true, displays a "Loading messages..." indicator at the top of the list. */ isLoading?: boolean; /** * Whether there are more historical messages available to load. * When false, displays "No more messages to load" indicator instead of loading spinner. */ hasMoreHistory?: boolean; /** * Callback triggered when the user scrolls to view a specific message. * @param messageSerial - The serial of the message currently in view */ onMessageInView?: (messageSerial: string) => void; /** * Callback triggered when the user scrolls to the bottom of the message list. */ onViewLatest?: () => void; /** * Callback triggered when a user saves an edited message. * Passed through to individual ChatMessage components. * @param message - The original message being edited * @param newText - The updated message content */ onEdit?: (message: Message, newText: string) => void; /** * Callback triggered when a user confirms deletion of their message. * Passed through to individual ChatMessage components. * @param message - The message to be deleted */ onDelete?: (message: Message) => void; /** * Callback triggered when a user adds an emoji reaction to any message. * Passed through to individual ChatMessage components. * @param message - The message receiving the reaction * @param emoji - The emoji character being added */ onReactionAdd?: (message: Message, emoji: string) => void; /** * Callback triggered when a user removes their emoji reaction from a message. * Passed through to individual ChatMessage components. * @param message - The message losing the reaction * @param emoji - The emoji character being removed */ onReactionRemove?: (message: Message, emoji: string) => void; /** * Optional React elements to render after all messages (e.g., TypingIndicators). * Commonly used for typing indicators, system messages, or loading states. */ children?: React.ReactNode; /** * Whether to automatically scroll to bottom when new messages arrive. * Only scrolls if user is already at/near the bottom to avoid interrupting reading. * @default true */ autoScroll?: boolean; /** * Distance in pixels from the top edge that triggers onLoadMoreHistory callback. * Lower values require more precise scrolling, higher values load history earlier. * @default 100 */ loadMoreThreshold?: number; /** * Whether to enable built-in typing indicators for other users. * Displays animated dots when other users are typing in the chat room. * @default true */ enableTypingIndicators?: boolean; /** * Additional CSS classes to apply to the message list container. * Merged with default styling classes using clsx. */ className?: string; } /** * ChatMessageList component provides a scrollable, virtualized container for chat messages * * Features: * - Infinite scroll with lazy loading of message history * - Smart auto-scroll that respects user's current position * - Loading states and indicators for history fetching * - Maintains scroll position when prepending historical messages * - Full accessibility support with ARIA labels * - Forward ref support for external scroll control * * @example * // Basic usage * * * @example * // Rendering children like typing indicators * * * * */ export declare const ChatMessageList: React.ForwardRefExoticComponent>;