import React, { useEffect } from 'react'; // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore

import preventScroll from 'prevent-scroll';
export default (function (_ref) {
  var children = _ref.children,
      visible = _ref.visible;
  useEffect(function () {
    if (visible) {
      preventScroll.on();
    } else {
      preventScroll.off();
    }

    return function () {
      preventScroll.off();
    };
  }, [visible]);
  return /*#__PURE__*/React.createElement("div", null, children);
});