// @flow import * as React from 'react'; import type { Node } from 'react'; import { injectIntl } from 'react-intl'; import type { IntlShape } from 'react-intl'; import { AutoSizer } from '@box/react-virtualized/dist/es/AutoSizer/index'; import { WindowScroller } from '@box/react-virtualized/dist/es/WindowScroller/index'; import type { SortParams } from './flowTypes'; import BaseVirtualizedTable from './BaseVirtualizedTable'; import './VirtualizedTable.scss'; type SortHandler = SortParams => void; export type VirtualizedTableProps = { children: Node | (any => Node), className?: string, height?: number, rowData: Array, rowGetter?: ({ index: number }) => any, sort?: SortHandler, }; type Props = VirtualizedTableProps & { intl: IntlShape }; const VirtualizedTable = ({ children, height, intl, ...rest }: Props) => ( {({ width }) => height ? ( {typeof children === 'function' ? children(intl) : children} ) : ( {({ height: dynamicHeight, isScrolling, onChildScroll, scrollTop }) => ( {typeof children === 'function' ? children(intl) : children} )} ) } ); export default injectIntl(VirtualizedTable);