1 | import { JSX, PureComponent } from "react";
|
2 |
|
3 | export type Size = {
|
4 | height: number;
|
5 | width: number;
|
6 | };
|
7 | export type Dimensions = Size;
|
8 |
|
9 | export type AutoSizerProps = {
|
10 | |
11 |
|
12 |
|
13 |
|
14 |
|
15 | children: (props: Size) => React.ReactNode;
|
16 | |
17 |
|
18 |
|
19 |
|
20 | className?: string | undefined;
|
21 | |
22 |
|
23 |
|
24 |
|
25 | defaultHeight?: number | undefined;
|
26 | |
27 |
|
28 |
|
29 |
|
30 | defaultWidth?: number | undefined;
|
31 |
|
32 | disableHeight?: boolean | undefined;
|
33 |
|
34 | disableWidth?: boolean | undefined;
|
35 |
|
36 | nonce?: string | undefined;
|
37 |
|
38 | onResize?: ((info: Size) => any) | undefined;
|
39 | /**
|
40 | * Optional custom inline style to attach to root AutoSizer element.
|
41 | * This is an advanced property and is not typically necessary.
|
42 | */
|
43 | style?: React.CSSProperties | undefined;
|
44 | /**
|
45 | * PLEASE NOTE
|
46 | * The [key: string]: any; line is here on purpose
|
47 | * This is due to the need of force re-render of PureComponent
|
48 | * Check the following link if you want to know more
|
49 | * https://github.com/bvaughn/react-virtualized#pass-thru-props
|
50 | */
|
51 | [key: string]: any;
|
52 | };
|
53 | /**
|
54 | * Decorator component that automatically adjusts the width and height of a single child.
|
55 | * Child component should not be declared as a child but should rather be specified by a `ChildComponent` property.
|
56 | * All other properties will be passed through to the child component.
|
57 | */
|
58 | export class AutoSizer extends PureComponent<AutoSizerProps, Size> {
|
59 | static defaultProps: {
|
60 | onResize: () => void;
|
61 | disableHeight: false;
|
62 | disableWidth: false;
|
63 | style: {};
|
64 | };
|
65 |
|
66 | constructor(props: AutoSizerProps);
|
67 |
|
68 | componentDidMount(): void;
|
69 |
|
70 | componentWillUnmount(): void;
|
71 |
|
72 | render(): JSX.Element;
|
73 | }
|
74 |
|
75 | export default AutoSizer;
|