aboutsummaryrefslogtreecommitdiff
path: root/src/lib/SmartList/SmartList.js
blob: b462c476bdfd1cefd6fbc5a07a2c7a0bd72b6feb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import React from 'react';

import { FixedSizeList } from 'react-window';
import AutoSizer from 'react-virtualized-auto-sizer';


const SmartList = ({ itemSize, itemCount, renderItem }) => {

  return (
    <div style={{ flex: '1 1 auto', overflow: 'hidden' }}>
      <AutoSizer>
        {({ width, height }) => (
          <FixedSizeList
            height={height}
            width={width}
            itemSize={itemSize}
            itemCount={itemCount}
          >
            {renderItem}
          </FixedSizeList>
        )}
      </AutoSizer>
    </div>
  );
};


export default SmartList;