aboutsummaryrefslogtreecommitdiff
path: root/src/components/SmartList/SmartList.js
blob: 68235a2389c56117fc9bd3eda2cf0f255507481f (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'}}>
      <AutoSizer>
        {({ width, height }) => (
          <FixedSizeList
            height={height}
            width={width}
            itemSize={itemSize}
            itemCount={itemCount}
          >
            {renderItem}
          </FixedSizeList>
        )}
      </AutoSizer>
    </div>
  );
};


export default SmartList;