From 69206fb3ee92ac6f17d6b52976f5047bf3525d24 Mon Sep 17 00:00:00 2001 From: Mingze Xiao Date: Wed, 8 Jan 2020 11:12:51 -0800 Subject: [PATCH] feat(archive): Fix virtualized table cannot scroll --- src/lib/viewers/archive/ArchiveExplorer.js | 86 ++++++++++--------- src/lib/viewers/archive/ArchiveExplorer.scss | 4 + .../__tests__/ArchiveExplorer-test-react.js | 1 - 3 files changed, 51 insertions(+), 40 deletions(-) diff --git a/src/lib/viewers/archive/ArchiveExplorer.js b/src/lib/viewers/archive/ArchiveExplorer.js index 5c4dfffdd..456a45dfa 100644 --- a/src/lib/viewers/archive/ArchiveExplorer.js +++ b/src/lib/viewers/archive/ArchiveExplorer.js @@ -4,15 +4,16 @@ import elementsMessages from 'box-elements-messages'; // eslint-disable-line import intlLocaleData from 'react-intl-locale-data'; // eslint-disable-line import Internationalize from 'box-ui-elements/es/elements/common/Internationalize'; import fuzzySearch from 'box-ui-elements/es/utils/fuzzySearch'; +import VirtualizedTable from 'box-ui-elements/es/features/virtualized-table'; +import { AutoSizer } from 'react-virtualized'; +import { Column, SortDirection } from 'react-virtualized/dist/es/Table/index'; import { itemNameCellRenderer, readableTimeCellRenderer, sizeCellRenderer, sortableColumnHeaderRenderer, } from 'box-ui-elements/es/features/virtualized-table-renderers'; -import VirtualizedTable from 'box-ui-elements/es/features/virtualized-table'; import { addLocaleData } from 'react-intl'; -import { Column, SortDirection } from 'react-virtualized/dist/es/Table/index'; import Breadcrumbs from './Breadcrumbs'; import SearchBar from './SearchBar'; import { TABLE_COLUMNS, VIEWS } from './constants'; @@ -189,43 +190,50 @@ class ArchiveExplorer extends React.Component {
- - {intl => [ - , - , - , - ]} - +
+ + {({ height }) => ( + + {intl => [ + , + , + , + ]} + + )} + +
); diff --git a/src/lib/viewers/archive/ArchiveExplorer.scss b/src/lib/viewers/archive/ArchiveExplorer.scss index 8eaac2ed4..8ea2cfc0f 100644 --- a/src/lib/viewers/archive/ArchiveExplorer.scss +++ b/src/lib/viewers/archive/ArchiveExplorer.scss @@ -4,3 +4,7 @@ width: 100%; height: 100%; } + +.bp-AutoSizerContainer { + height: 100%; +} diff --git a/src/lib/viewers/archive/__tests__/ArchiveExplorer-test-react.js b/src/lib/viewers/archive/__tests__/ArchiveExplorer-test-react.js index 732433bac..6a32f8236 100644 --- a/src/lib/viewers/archive/__tests__/ArchiveExplorer-test-react.js +++ b/src/lib/viewers/archive/__tests__/ArchiveExplorer-test-react.js @@ -59,7 +59,6 @@ describe('lib/viewers/archive/ArchiveExplorer', () => { expect(component.find('SearchBar').length).to.equal(1); expect(component.find('Breadcrumbs').length).to.equal(1); expect(component.find('Internationalize').length).to.equal(1); - expect(component.find('InjectIntl(VirtualizedTable)').length).to.equal(1); }); });