Custom ref handle returned by VirtualScroll that exposes imperative methods

Use React.useRef<VirtualScrollProxy>(null) to create a ref.

interface VirtualScrollProxy {
    get clientHeight(): number;
    get clientWidth(): number;
    get horizontalOffset(): number;
    get verticalOffset(): number;
    scrollTo(verticalOffset?: number, horizontalOffset?: number): void;
    scrollToArea(verticalOffset?: number, verticalSize?: number, horizontalOffset?: number, horizontalSize?: number, option?: ScrollToOption): void;
}

Accessors

Methods

  • Scrolls to the specified vertical and horizontal offset in pixels Either offset can be left undefined to scroll in one dimension only

    Parameters

    • OptionalverticalOffset: number

      Offset to scroll to vertically

    • OptionalhorizontalOffset: number

      Offset to scroll to horizontally

    Returns void

  • Scrolls to the specified area Either offset/size pair can be left undefined to scroll in one dimension only

    Parameters

    • OptionalverticalOffset: number

      Offset to scroll to vertically

    • OptionalverticalSize: number

      Size of target area vertically

    • OptionalhorizontalOffset: number

      Offset to scroll to horizontally

    • OptionalhorizontalSize: number

      Size of target area horizontally

    • Optionaloption: ScrollToOption

      Where to position the area within the viewport

    Returns void