@fluentui/react-northstar
Version:
A themable React component library.
21 lines (20 loc) • 1.08 kB
TypeScript
import * as React from 'react';
import { UseTreeResult, UseTreeOptions } from './useTree';
import { ShorthandValue } from '../../../types';
import { TreeItemProps } from '../TreeItem';
export interface UseVirtualTreeOptions extends Omit<UseTreeOptions, 'selectedItemIds' | 'defaultSelectedItemIds'> {
/**
* A function that converts an item to string. Used for keyboard navigation based on the first letter of an item's text content
*/
itemToString?: (item: ShorthandValue<TreeItemProps>) => string;
}
export interface UseVirtualTreeResult extends UseTreeResult {
/** ref to be assigned to react-window VariableSizeList/FixedSizeList component */
listRef: React.MutableRefObject<any>;
}
export interface VariableSizeListRef extends React.Component<any> {
scrollTo(scrollOffset: number): void;
scrollToItem(index: number, align?: 'auto' | 'smart' | 'center' | 'end' | 'start'): void;
resetAfterIndex(index: number, shouldForceUpdate?: boolean): void;
}
export declare function useVirtualTree(props: UseVirtualTreeOptions): UseVirtualTreeResult;