import React from 'react';
import { isIE11 } from '../_utils/isIE11';
export function useScrollLock(shouldScrollLock) {
  React.useEffect(function () {
    var IE11 = isIE11();
    if (!IE11 && shouldScrollLock) {
      var bodyPosition = document.body.style.position;
      var bodyTop = document.body.style.top;
      document.body.style.top = "-".concat(window.scrollY, "px");
      document.body.style.position = 'fixed';
      return function () {
        var scrollY = document.body.style.top;
        document.body.style.position = bodyPosition;
        document.body.style.top = bodyTop;
        window.scrollTo(0, parseInt(scrollY || '0') * -1);
      };
    }
  }, [shouldScrollLock]);
}
//# sourceMappingURL=ScrollLock.js.map