/// /// /// import * as React from "react"; import * as ReactDOM from "react-dom"; import { Collection, FlexTable, FlexColumn, SortDirection, Grid, VirtualScroll, ArrowKeyStepper, AutoSizer, CellMeasurer, ColumnSizer, InfiniteLoader, ScrollSync, WindowScroller, List, Column, Table, } from "react-virtualized"; /* * Collection */ function CollectionTest() { const list = [ { name: "Brian Vaughn", x: 13, y: 34, width: 123, size: 234, height: 123 } ]; // Render your grid ReactDOM.render( list[index].name} cellSizeAndPositionGetter={({ index }) => { const datum = list[index]; return { height: datum.height, width: datum.width, x: datum.x, y: datum.y }; } } height={300} width={300} />, document.getElementById("example") ); } function FlexTableTest() { const list = [ { name: 'Brian Vaughn', description: 'Software engineer' } // And so on... ]; // Render your table ReactDOM.render( list[index] } > , document.getElementById("example") ); } function GridTest() { // Grid data as an array of arrays const list = [ ['Brian Vaughn', 'Software Engineer', 'San Jose', 'CA', 95125 /* ... */] // And so on... ]; // Render your grid ReactDOM.render( list[rowIndex][columnIndex]} />, document.getElementById('example') ); } 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 TableTest() { const list = [ { name: 'Brian Vaughn', description: 'Software engineer' } // And so on... ]; ReactDOM.render( list[index]} > , document.getElementById('example') ); } function VirtualScrollTest() { // List data as an array of strings const list = [ 'Brian Vaughn' // And so on... ]; // Render your list ReactDOM.render( list[index]} />, document.getElementById('example') ); } function ArrowKeyStepperTest() { const columnCount = 12; const rowCount = 3; ReactDOM.render( {({ onSectionRendered, scrollToColumn, scrollToRow }) => ( ) } , document.getElementById('example') ); } function AutoSizerTest() { // List data as an array of strings const list = [ 'Brian Vaughn' // And so on... ]; // Render your list ReactDOM.render( {({ height, width }) => ( list[index] // Could also be a DOM element } /> ) } , document.getElementById('example') ); } function CellMeasurerTest() { const columnCount = 12; const rowCount = 3; const cellRenderer = ({ columnIndex, rowIndex }) => `${rowIndex}, ${columnIndex}`; const fixedRowHeight = 42; const height = 12; const width = 12; ReactDOM.render( {({ getColumnWidth }) => ( ) } , document.getElementById('example') ); } function ColumnSizerTest() { ReactDOM.render( {({ adjustedWidth, getColumnWidth, registerChild }) => ( "test"} rowHeight={50} rowCount={12} width={adjustedWidth} /> ) } , document.getElementById('example') ); } function InfiniteLoaderTest() { const list: string[] = []; function isRowLoaded({ index }) { return !!list[index]; } function loadMoreRows({ startIndex, stopIndex }) { return list.push('test'); } // Render your list ReactDOM.render( {({ onRowsRendered, registerChild }) => ( list[index] // Could also be a DOM element } /> ) } , document.getElementById('example') ); } function ScrollSyncTest() { return ( {({ clientHeight, clientWidth, onScroll, scrollHeight, scrollLeft, scrollTop, scrollWidth }) => ( "test"} rowCount={42} height={12} width={12} rowHeight={120} scrollTop={scrollTop}/> /> ) } ); } function WindowScrollerTest() { const onScroll = function({scrollTop}: WindowScroller.OnScrollArg) {}; const onResize = function({height}: WindowScroller.OnResizeArg) {}; ReactDOM.render( {({ height, isScrolling, scrollTop }: WindowScroller.RenderCallbackArg) => ( 'test'} scrollTop={scrollTop} width={120}/> ) } , document.getElementById('example') ); // test that onScroll & onResize are optional ReactDOM.render( , document.getElementById('example') ); }