jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
39 lines (38 loc) • 1.44 kB
TypeScript
/**
* 基于 https://github.com/clauderic/react-tiny-virtual-list 改造,主要是加了宽度自适应
*/
import * as React from 'react';
import SizeAndPositionManager from './SizeAndPositionManager';
import { SCROLL_CHANGE_REASON } from './constants';
import type { VListProps } from './types';
export interface VListState {
offset: number;
scrollChangeReason: SCROLL_CHANGE_REASON;
}
export default class VirtualList extends React.PureComponent<VListProps, VListState> {
static defaultProps: Partial<VListProps>;
/**
* 容器宽度或者高度缓存值
*/
containerSize: number | undefined;
itemSizeGetter: (itemSize: VListProps["itemSize"]) => (index: any) => any;
sizeAndPositionManager: SizeAndPositionManager;
readonly state: VListState;
private rootNode;
private styleCache;
componentDidMount(): void;
updateRootWidth(): void;
componentDidUpdate(prevProps: VListProps, prevState: VListState): void;
componentWillUnmount(): void;
scrollTo(value: number): void;
getOffsetForIndex(index: number, scrollToAlignment?: import("./constants").ALIGNMENT | undefined, itemCount?: number): number;
recomputeSizes(startIndex?: number): void;
calcContainerSize: () => number;
render(): JSX.Element;
private getRef;
private handleScroll;
private getNodeOffset;
private getEstimatedItemSize;
private getSize;
private getStyle;
}