UNPKG

react-scroll-blocker

Version:

A modern React 18 compatible scroll lock component for preventing body scroll

15 lines (14 loc) 573 B
/** * A React hook that provides scroll blocking functionality. * This is useful when you want to control scroll blocking programmatically * without using the ScrollBlocker component. * * @param isBlocked - Whether scroll should be blocked * @param accountForScrollbars - Whether to account for scrollbar width * @returns An object with methods to manually block/unblock scroll */ export declare function useScrollBlocker(isBlocked?: boolean, accountForScrollbars?: boolean): { blockScroll: () => void; unblockScroll: () => void; isBlocked: boolean; };