diff --git a/desktop/flipper-plugin/src/index.tsx b/desktop/flipper-plugin/src/index.tsx index b3f7f18d4..01a563323 100644 --- a/desktop/flipper-plugin/src/index.tsx +++ b/desktop/flipper-plugin/src/index.tsx @@ -61,6 +61,8 @@ export {DataTableManager} from './ui/data-table/DataTableManager'; export {DataList} from './ui/DataList'; export {Spinner} from './ui/Spinner'; +export {DataSourceVirtualizer} from './data-source/DataSourceRendererVirtual'; + export { Interactive as _Interactive, InteractiveProps as _InteractiveProps, diff --git a/desktop/flipper-plugin/src/ui/data-table/DataTable.tsx b/desktop/flipper-plugin/src/ui/data-table/DataTable.tsx index f5eced75f..a9c5437b9 100644 --- a/desktop/flipper-plugin/src/ui/data-table/DataTable.tsx +++ b/desktop/flipper-plugin/src/ui/data-table/DataTable.tsx @@ -75,6 +75,7 @@ type DataTableBaseProps = { onSelect?(record: T | undefined, records: T[]): void; onRowStyle?(record: T): CSSProperties | undefined; tableManagerRef?: RefObject | undefined>; // Actually we want a MutableRefObject, but that is not what React.createRef() returns, and we don't want to put the burden on the plugin dev to cast it... + virtualizerRef?: RefObject; onCopyRows?(records: T[]): string; onContextMenu?: (selection: undefined | T) => React.ReactElement; onRenderEmpty?: @@ -159,7 +160,12 @@ export function DataTable( // eslint-disable-next-line const scope = isUnitTest ? '' : usePluginInstanceMaybe()?.definition.id ?? ''; - const virtualizerRef = useRef(); + let virtualizerRef = useRef(); + if (props.virtualizerRef) { + virtualizerRef = props.virtualizerRef as React.MutableRefObject< + DataSourceVirtualizer | undefined + >; + } const [tableState, dispatch] = useReducer( dataTableManagerReducer as DataTableReducer, undefined,