Comparing version 1.9.1 to 1.9.2
import { BodyScrollOptions } from "body-scroll-lock"; | ||
import { RefObject } from "react"; | ||
export declare function useBodyScrollLock<T extends HTMLElement>(ref: RefObject<T>, isOpen: boolean, options?: Partial<BodyScrollOptions>): void; | ||
export declare function useBodyScrollLock<T extends HTMLElement>(ref: RefObject<T>, isOpen: boolean, clearAllOnClose?: boolean, options?: Partial<BodyScrollOptions>): void; |
@@ -16,3 +16,4 @@ "use strict"; | ||
var react_1 = require("react"); | ||
function useBodyScrollLock(ref, isOpen, options) { | ||
function useBodyScrollLock(ref, isOpen, clearAllOnClose, options) { | ||
if (clearAllOnClose === void 0) { clearAllOnClose = false; } | ||
react_1.useEffect(function () { | ||
@@ -33,12 +34,14 @@ var targetNode = ref.current; | ||
} | ||
else { | ||
return function () { | ||
body_scroll_lock_1.enableBodyScroll(targetNode); | ||
} | ||
}; | ||
} | ||
return function () { | ||
body_scroll_lock_1.clearAllBodyScrollLocks(); | ||
}; | ||
}, [isOpen, options, ref]); | ||
else if (clearAllOnClose) { | ||
return function () { | ||
body_scroll_lock_1.clearAllBodyScrollLocks(); | ||
}; | ||
} | ||
}, [clearAllOnClose, isOpen, options, ref]); | ||
} | ||
exports.useBodyScrollLock = useBodyScrollLock; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlQm9keVNjcm9sbExvY2suanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaG9va3MvdXNlQm9keVNjcm9sbExvY2sudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7OztBQUFBLHFEQUFtSDtBQUNuSCwrQkFBNkM7QUFFN0MsU0FBZ0IsaUJBQWlCLENBQzdCLEdBQWlCLEVBQ2pCLE1BQWUsRUFDZixPQUFvQztJQUVwQyxpQkFBUyxDQUFDO1FBQ04sSUFBTSxVQUFVLEdBQUcsR0FBRyxDQUFDLE9BQU8sQ0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ivElement>(innerRef, isOpen, { /* options from "body-scroll-lock" npm package */}); | ||
const clearAllOnclose = false; /* optionally call clearAllBodyScrollLocks methot on unmount */ | ||
useBodyScrollLock<HTMLDivElement>(innerRef, isOpen, clearAllOnclose, { /* options from "body-scroll-lock" npm package */ }); | ||
<div ref={innerRef}>Element which activates scroll lock on its parent elements.</div> | ||
@@ -37,0 +39,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69930
781
153