import { useEffect } from "react";
export function useDisableScroll(ref) {
    var enabled = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
    useEffect(function() {
        if (!enabled || !ref.current) return;
        var el = ref.current;
        var preventScroll = function preventScroll(e) {
            e.preventDefault();
            e.stopPropagation();
        };
        el.addEventListener('wheel', preventScroll, {
            passive: false
        });
        el.addEventListener('touchmove', preventScroll, {
            passive: false
        });
        return function() {
            el.removeEventListener('wheel', preventScroll);
            el.removeEventListener('touchmove', preventScroll);
        };
    }, [
        ref,
        enabled
    ]);
}
