react-recycled-list
Version:
A React library for efficiently rendering large list with expensive component
69 lines (68 loc) • 2.59 kB
TypeScript
import { ReactRecycledListProps, ReactRecycledListState } from './TypeDef';
import GeneralList from './AbstractList';
import { RowToDataIndexMap } from './utils';
import React from 'react';
export interface FullWindowFixedListProps extends ReactRecycledListProps {
/**
* Amount of space considered invisible at top.
*
* Useful when you have a fixed position header that blocks some top part of the list.
*/
rootMarginTop?: number;
/**
* Amount of space considered invisible at bottom.
*
* Useful when you have a fixed position footer that blocks the some bottom part of the list.
*/
rootMarginBottom?: number;
/**
* No real effect.
*
* This is used in conjunction with ResponsiveWindowContainer to force rerender when window size change.
*/
windowHeight?: number;
/**
* Used for server side rendering.
*
* This specify the height of the list when rendered in the server side(otherwise would be 0).
*/
serverSideHeight?: number;
/**
* A React ref object that points to the element used to attach scroll listener.
*
* Defaults to window
*/
scrollRef?: React.MutableRefObject<HTMLElement | undefined | null>;
}
export default class FullWindowFixedList<P extends FullWindowFixedListProps, S extends ReactRecycledListState> extends GeneralList<P, S> {
rowPositions: number[];
rowHeights: number[];
rowToDataIndexMap: RowToDataIndexMap;
fullHeight: number;
windowHeight: number;
initialArrayTemplate: null[];
totalNumOfRenderedRows: number;
numOfInvisibleRowOnEachDirection: number;
totalRows: number;
timeOut: any;
initialScrolling: boolean;
fullListRef: React.RefObject<HTMLElement>;
scrollListener: HTMLElement | (Window & typeof globalThis) | undefined;
listWindowRef: any;
initializeProperties: (constructor?: boolean) => any;
constructor(props: P);
componentDidMount(): void;
componentWillUnmount(): void;
attachScrollListener: () => void;
getScrollTop: () => number;
onScroll: () => void;
manualScroll: (targetPosition: number) => void;
shouldResetList: (prevProps: P) => boolean;
resetListAndRef: () => void;
componentDidUpdate(prevProps: P): void;
setCustomScrollRef: () => void;
getTopViewportRowIndex: (scrollTop: number) => number;
getBottomViewportRowIndex: (viewportBottom: number) => number;
getResetViewportBottom: () => number;
render(): JSX.Element;
}