diff --git a/react-virtualized/index.d.ts b/react-virtualized/index.d.ts index 345dcc79db..ab43deb8b7 100644 --- a/react-virtualized/index.d.ts +++ b/react-virtualized/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for react-virtualized +// Type definitions for react-virtualized 8.9.0 // Project: https://github.com/bvaughn/react-virtualized -// Definitions by: Ian Ker-Seymer +// Definitions by: Andrew de Waal // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -50,6 +50,26 @@ declare module "react-virtualized" { type GridProps = any; export class Grid extends React.Component { } + interface ListProps { + className?: string; + autoHeight?: boolean; + estimatedRowSize?: number; + height: number; + noRowsRenderer?: Function; + onRowsRendered?: (info: { overscanStartIndex: number, overscanStopIndex: number, startIndex: number, stopIndex: number }) => void; + onScroll?: (info: { clientHeight: number, scrollHeight: number, scrollTop: number }) => void; + overscanRowCount?: number; + rowHeight: number | ((info: { index: number }) => number); + rowRenderer: (info: { index: number, isScrolling: boolean }) => React.ReactNode; + rowCount: number; + scrollToAlignment?: string; + scrollToIndex?: number; + scrollTop?: number; + style?: React.CSSProperties; + tabIndex?: number; + width: number; + } + export class List extends React.Component { } /* * Higher-Order Components diff --git a/react-virtualized/react-virtualized-tests.tsx b/react-virtualized/react-virtualized-tests.tsx index 6c799746fd..791e4df9a0 100644 --- a/react-virtualized/react-virtualized-tests.tsx +++ b/react-virtualized/react-virtualized-tests.tsx @@ -19,6 +19,7 @@ import { InfiniteLoader, ScrollSync, WindowScroller, + List } from "react-virtualized"; /* @@ -107,6 +108,26 @@ function GridTest() { ); } +function ListTest() { + // List data + const list = [ + {name: 'Brian Vaughn', occupation: 'Software Engineer', location: 'San Jose, CA, 95125' /* ... */} + // And so on... + ]; + + // Render your List + ReactDOM.render( + list[index]} + />, + document.getElementById('example') + ); +} + function VirtualScrollTest() { // List data as an array of strings const list = [