@peersyst/react-hooks
Advanced tools
Comparing version 1.1.1 to 1.1.2
import { useEffect } from "react"; | ||
export default function usePreventBodyScroll(prevent) { | ||
useEffect(function () { | ||
if (prevent) document.body.style.overflow = "hidden";else document.body.style.removeProperty("overflow"); | ||
if (prevent) { | ||
document.body.style.overflow = "hidden"; | ||
document.documentElement.style.overflow = "hidden"; | ||
} else { | ||
document.body.style.removeProperty("overflow"); | ||
document.documentElement.style.removeProperty("overflow"); | ||
} | ||
}, [prevent]); | ||
} |
import { useEffect } from "react"; | ||
export default function usePreventBodyScroll(prevent) { | ||
useEffect(function () { | ||
if (prevent) document.body.style.overflow = "hidden";else document.body.style.removeProperty("overflow"); | ||
if (prevent) { | ||
document.body.style.overflow = "hidden"; | ||
document.documentElement.style.overflow = "hidden"; | ||
} else { | ||
document.body.style.removeProperty("overflow"); | ||
document.documentElement.style.removeProperty("overflow"); | ||
} | ||
}, [prevent]); | ||
} |
import { useEffect } from "react"; | ||
export default function usePreventBodyScroll(prevent) { | ||
useEffect(function () { | ||
if (prevent) document.body.style.overflow = "hidden";else document.body.style.removeProperty("overflow"); | ||
if (prevent) { | ||
document.body.style.overflow = "hidden"; | ||
document.documentElement.style.overflow = "hidden"; | ||
} else { | ||
document.body.style.removeProperty("overflow"); | ||
document.documentElement.style.removeProperty("overflow"); | ||
} | ||
}, [prevent]); | ||
} |
@@ -12,4 +12,10 @@ "use strict"; | ||
(0, _react.useEffect)(function () { | ||
if (prevent) document.body.style.overflow = "hidden";else document.body.style.removeProperty("overflow"); | ||
if (prevent) { | ||
document.body.style.overflow = "hidden"; | ||
document.documentElement.style.overflow = "hidden"; | ||
} else { | ||
document.body.style.removeProperty("overflow"); | ||
document.documentElement.style.removeProperty("overflow"); | ||
} | ||
}, [prevent]); | ||
} |
{ | ||
"name": "@peersyst/react-hooks", | ||
"author": "Peersyst", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "main": "./node/index.js", |
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
34583
685