@thibault.sh/hooks
Version:
A comprehensive collection of React hooks for browser storage, UI interactions, and more
21 lines (18 loc) • 694 B
TypeScript
import { RefObject } from 'react';
interface ContainerScroll {
scrollTop: number;
scrollLeft: number;
scrollWidth: number;
scrollHeight: number;
clientWidth: number;
clientHeight: number;
isScrolling: boolean;
}
/**
* Hook that tracks scroll position and dimensions of a container element
* @param containerRef - React ref object pointing to the container element
* @param delay - Delay in milliseconds before setting isScrolling to false
* @returns Object containing scroll position and dimension information
*/
declare function useContainerScroll(containerRef: RefObject<HTMLElement | null>, delay?: number): ContainerScroll;
export { useContainerScroll };