export interface UseIntersectionObserverOptions extends IntersectionObserverInit { /** * Skip creating the IntersectionObserver * @default false */ disabled?: boolean; /** * Callback function that will be called when intersection changes */ onIntersect?: (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => void; /** * If the IntersectionObserver API isn't available, set this fallback behavior */ fallback?: () => void; } export interface UseIntersectionObserverResult { /** The current intersection entries */ entries: IntersectionObserverEntry[]; /** Whether any of the observed elements are intersecting */ isIntersecting: boolean; /** Function to start observing an element */ observe: (element: Element) => void; /** Function to stop observing an element */ unobserve: (element: Element) => void; /** Function to stop observing all elements */ disconnect: () => void; /** The IntersectionObserver instance */ observer: IntersectionObserver | null; } /** * Low-level hook for IntersectionObserver API. * Provides direct access to observe/unobserve methods and entries. * * @param options - Configuration options for the IntersectionObserver * @returns Object containing observer methods and current entries * * @example * ```tsx * const Component = () => { * const ref = useRef(null); * const { observe, isIntersecting, entries } = useIntersectionObserver({ * threshold: 0.5, * onIntersect: (entries) => { * console.log('Intersection changed:', entries); * } * }); * * useEffect(() => { * if (ref.current) { * observe(ref.current); * } * }, [observe]); * * return
Content
; * }; * ``` */ export declare function useIntersectionObserver(options?: UseIntersectionObserverOptions): UseIntersectionObserverResult;