import React, { useContext } from 'react';
import { observer } from 'mobx-react-lite';
import TableContext from './TableContext';

var VirtualVerticalContainer = function VirtualVerticalContainer(props) {
  var children = props.children,
      renderBefore = props.renderBefore;

  var _useContext = useContext(TableContext),
      tableStore = _useContext.tableStore;

  var virtualStartIndex = tableStore.virtualStartIndex;
  var virtualEndIndex = tableStore.virtualEndIndex;
  var rows = [];

  if (renderBefore) {
    var before = renderBefore(virtualStartIndex);

    if (before) {
      rows.push(before);
    }
  }

  while (virtualStartIndex < virtualEndIndex) {
    rows.push(children(virtualStartIndex));
    virtualStartIndex++;
  }

  return /*#__PURE__*/React.createElement(React.Fragment, null, rows);
};

VirtualVerticalContainer.displayName = 'VirtualVerticalContainer';
export default observer(VirtualVerticalContainer);
//# sourceMappingURL=VirtualVerticalContainer.js.map
