@activecollab/components
Version:
ActiveCollab Components
17 lines • 474 B
JavaScript
import { useRef, useEffect } from "react";
export const useInitScrollRef = function (element, invert) {
if (invert === void 0) {
invert = false;
}
const ref = useRef(element);
useEffect(() => {
if (ref.current) {
ref.current.scrollTop = invert ? -1 : 1;
ref.current.scrollTop = 0;
ref.current.scrollLeft = invert ? -1 : 1;
ref.current.scrollLeft = 0;
}
}, [invert]);
return ref;
};
//# sourceMappingURL=useInitScrollRef.js.map