UNPKG

@adaptabletools/adaptable

Version:

Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

32 lines (31 loc) 1.1 kB
import * as React from 'react'; type OnResizeFn = (size: { width: number; height: number; }) => void; interface ResizeObserverProps { /** * Specifies whether to call onResize after the initial render (on mount) * * @default true */ notifyOnMount?: boolean; /** * If set to true, it will be attached using `useLayoutEffect`. If false, will be attached using `useEffect` * @default false */ earlyAttach?: boolean; onResize: OnResizeFn; } export declare const setupResizeObserver: (node: HTMLElement, callback: OnResizeFn) => (() => void); /** * A hook that notifies you when a certain DOM element has changed it's size * * @param ref A React ref to a DOM element * @param callback The function to be called when the element is resized. */ export declare const useResizeObserver: (ref: React.MutableRefObject<HTMLElement | null>, callback: OnResizeFn, config?: { earlyAttach: boolean; }) => void; export declare const ReactResizeObserver: ({ notifyOnMount, earlyAttach, ...props }: ResizeObserverProps) => React.JSX.Element; export {};