Chat Viewer
    Preparing search index...

    Interface ChatViewerHandle<M>

    interface ChatViewerHandle<M extends IdentifiableMessage = IdentifiableMessage> {
        atBottom: boolean;
        atTop: boolean;
        idsToIndexes: Map<MessageId<M>, number>;
        indexesToIds: Map<number, MessageId<M>>;
        newestIdInViewport: undefined | MessageId<M>;
        newestIndexInViewport: number;
        newestSeenId: undefined | MessageId<M>;
        newestSeenIndex: undefined | number;
        oldestIdInViewport: undefined | MessageId<M>;
        oldestIndexInViewport: number;
        oldestSeenId: undefined | MessageId<M>;
        oldestSeenIndex: undefined | number;
        scrollOffset: undefined | number;
        scrollSize: undefined | number;
        viewportSize: undefined | number;
        vListHandle: null | VListHandle;
        wasIdSeen: (id: MessageId<M>) => boolean;
        wasIndexSeen: (index: number) => boolean;
        getIdOffset(id: MessageId<M>): undefined | number;
        getIdSize(id: MessageId<M>): undefined | number;
        getIndexOffset(index: number): undefined | number;
        getIndexSize(index: number): undefined | number;
        isIdInViewport(id: MessageId<M>): boolean;
        isIndexInViewport(index: number): boolean;
        scrollBy(offset: number): void;
        scrollToBottom(opts?: ScrollToIndexOpts): void;
        scrollToId(id: MessageId<M>, opts?: ScrollToIndexOpts): void;
        scrollToIndex(index: number, opts?: ScrollToIndexOpts): void;
        scrollToOffset(offset: number): void;
        scrollToTop(opts?: ScrollToIndexOpts): void;
    }

    Type Parameters

    Index

    Methods

    • Returns the scroll offset for the given message ID, or undefined if not available.

      Parameters

      Returns undefined | number

    • Returns the size of the item with the given message ID, or undefined if not available.

      Parameters

      Returns undefined | number

    • Returns the scroll offset for the given index, or undefined if not available.

      Parameters

      • index: number

        The index to get the offset for.

      Returns undefined | number

    • Returns the size of the item at the given index, or undefined if not available.

      Parameters

      • index: number

        The index to get the size for.

      Returns undefined | number

    • Returns true if the given index is currently visible in the viewport.

      Parameters

      • index: number

        The index to check.

      Returns boolean

    • Scrolls by the specified offset.

      Parameters

      • offset: number

        The amount to scroll by.

      Returns void

    • Scrolls to the bottom of the messages list.

      Parameters

      • Optionalopts: ScrollToIndexOpts

        Optional scroll options.

      Returns void

    • Scrolls to the item with the specified message ID.

      Parameters

      • id: MessageId<M>

        The message ID to scroll to.

      • Optionalopts: ScrollToIndexOpts

        Optional scroll options.

      Returns void

    • Scrolls to the specified index.

      Parameters

      • index: number

        The index to scroll to.

      • Optionalopts: ScrollToIndexOpts

        Optional scroll options.

      Returns void

    • Scrolls to the specified offset.

      Parameters

      • offset: number

        The scroll offset to scroll to.

      Returns void

    • Scrolls to the top of the messages list.

      Parameters

      • Optionalopts: ScrollToIndexOpts

        Optional scroll options.

      Returns void

    Properties

    atBottom: boolean

    Whether the viewport is currently at the bottom of the message list. Use ChatViewerProps#onAtBottom to be notified when the viewport reaches the bottom.

    atTop: boolean

    Whether the viewport is currently at the top of the message list. Use ChatViewerProps#onAtTop to be notified when the viewport reaches the top.

    idsToIndexes: Map<MessageId<M>, number>

    Map of message IDs to their corresponding indexes in the list.

    indexesToIds: Map<number, MessageId<M>>

    Map of indexes to their corresponding MessageId in the list.

    newestIdInViewport: undefined | MessageId<M>

    The MessageId of the newest message currently visible in the viewport, or undefined if not available.

    newestIndexInViewport: number

    The index of the newest message currently visible in the viewport.

    newestSeenId: undefined | MessageId<M>

    The MessageId of the newest message that is present in the viewport, or undefined if not available.

    newestSeenIndex: undefined | number

    The index of the newest message that is present in the viewport, or undefined if not available.

    oldestIdInViewport: undefined | MessageId<M>

    The MessageId of the oldest message currently visible in the viewport, or undefined if not available.

    oldestIndexInViewport: number

    The index of the oldest message currently visible in the viewport.

    oldestSeenId: undefined | MessageId<M>

    The MessageId of the oldest message that has been seen (was at least once within the viewport), or undefined if not available.

    oldestSeenIndex: undefined | number

    The index of the oldest message that has been seen (was at least once within the viewport), or undefined if not available.

    scrollOffset: undefined | number

    Current scroll offset, or undefined if not available.

    scrollSize: undefined | number

    Total scrollable size, or undefined if not available.

    viewportSize: undefined | number

    Size of the viewport, or undefined if not available.

    vListHandle: null | VListHandle

    Reference to the underlying Virtua's VListHandle, or null if not available.

    wasIdSeen: (id: MessageId<M>) => boolean

    Returns true if the given message ID has ever been seen in the viewport.

    Type declaration

    wasIndexSeen: (index: number) => boolean

    Returns true if the given index has ever been seen in the viewport.

    Type declaration

      • (index: number): boolean
      • Parameters

        • index: number

          The index to check.

        Returns boolean