Bluesky app fork with some witchin' additions 💫 forked from jollywhoppers.com/witchsky.app
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132import {useEffect} from 'react'
import {isWeb} from '#/platform/detection'
let refCount = 0
function incrementRefCount() { if (refCount === 0) { document.body.style.overflow = 'hidden' document.documentElement.style.scrollbarGutter = 'auto' } refCount++}
function decrementRefCount() { refCount-- if (refCount === 0) { document.body.style.overflow = '' document.documentElement.style.scrollbarGutter = '' }}
export function useWebBodyScrollLock(isLockActive: boolean) { useEffect(() => { if (!isWeb || !isLockActive) { return } incrementRefCount() return () => decrementRefCount() })}