forked from ctrlplusb/react-sizeme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreact-sizeme.d.ts
51 lines (39 loc) · 1.26 KB
/
react-sizeme.d.ts
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
42
43
44
45
46
47
48
49
50
51
/* eslint-disable */
import { Component, ComponentType, ReactNode, ReactElement } from 'react'
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>
declare namespace sizeMe {
export interface SizeMeProps {
readonly size: {
readonly width: number | null
readonly height: number | null
}
}
export interface SizeMeOptions {
monitorHeight?: boolean
monitorWidth?: boolean
noPlaceholder?: boolean
refreshMode?: 'throttle' | 'debounce'
refreshRate?: number
resizeDetectorStrategy?: 'scroll' | 'object'
}
export interface SizeMeRenderProps extends SizeMeOptions {
children: (props: SizeMeProps) => ReactElement
}
export class SizeMe extends Component<SizeMeRenderProps> {}
export type WithSizeOnSizeCallback = (size: SizeMeProps['size']) => void
export interface WithSizeProps {
onSize?: WithSizeOnSizeCallback
}
export function withSize(
options?: SizeMeOptions,
): <P extends object = {}>(
component: ComponentType<P>,
) => ComponentType<Omit<P, 'size'> & WithSizeProps>
export let noPlaceholders: boolean
}
declare function sizeMe(
options?: sizeMe.SizeMeOptions,
): <P extends object = {}>(
component: ComponentType<P>,
) => ComponentType<Omit<P, 'size'> & sizeMe.WithSizeProps>
export = sizeMe