Merge pull request #54 from matias4205/master

Fix: hasScrolled functionality
This commit is contained in:
B 2020-11-02 15:49:25 -03:00 committed by GitHub
commit 49e5f80e4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,7 +36,7 @@ const Layout: FC<Props> = ({ children, pageProps }) => {
isDisabled: !(displaySidebar || displayModal),
})
const handleScroll = useCallback(() => {
const handleScroll = useCallback(
debounce(() => {
const offset = 0
const { scrollTop } = document.documentElement
@ -44,7 +44,7 @@ const Layout: FC<Props> = ({ children, pageProps }) => {
setHasScrolled(scrolled)
}, 1)
}, [])
, [])
useEffect(() => {
document.addEventListener('scroll', handleScroll)