index.d.ts
1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import * as React from 'react';
import ResizeObserver from 'resize-observer-polyfill';
export interface ResizeObserverProps {
children: React.ReactNode;
disabled?: boolean;
/** Trigger if element resized. Will always trigger when first time render. */
onResize?: (size: {
width: number;
height: number;
offsetWidth: number;
offsetHeight: number;
}) => void;
}
interface ResizeObserverState {
height: number;
width: number;
offsetHeight: number;
offsetWidth: number;
}
declare type RefNode = React.ReactInstance | HTMLElement | null;
declare class ReactResizeObserver extends React.Component<ResizeObserverProps, ResizeObserverState> {
static displayName: string;
resizeObserver: ResizeObserver | null;
childNode: RefNode;
currentElement: Element | null;
state: {
width: number;
height: number;
offsetHeight: number;
offsetWidth: number;
};
componentDidMount(): void;
componentDidUpdate(): void;
componentWillUnmount(): void;
onComponentUpdated(): void;
onResize: ResizeObserverCallback;
setChildNode: (node: RefNode) => void;
destroyObserver(): void;
render(): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)>) | (new (props: any) => React.Component<any, any, any>)> | React.ReactElement<unknown, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)>) | (new (props: any) => React.Component<any, any, any>)>[];
}
export default ReactResizeObserver;