|
1 | 1 | declare module 'react-intersection-observer' { |
2 | | - import React = require('react'); |
| 2 | + import React = require('react') |
3 | 3 |
|
4 | 4 | export interface IntersectionObserverProps { |
5 | 5 | /** Children should be either a function or a node */ |
6 | | - children?: React.ReactNode | ((inView: boolean) => React.ReactNode); |
| 6 | + children?: React.ReactNode | ((inView: boolean) => React.ReactNode) |
7 | 7 |
|
8 | 8 | /** Render prop boolean indicating inView state */ |
9 | | - render?(inView: boolean): React.ReactNode; |
10 | | - |
| 9 | + render?: (inView: boolean) => React.ReactNode |
11 | 10 |
|
12 | 11 | /** |
13 | 12 | * The `HTMLElement` that is used as the viewport for checking visibility of |
14 | 13 | * the target. |
15 | 14 | * Defaults to the browser viewport if not specified or if `null`. |
16 | 15 | */ |
17 | | - root?: HTMLElement | null; |
| 16 | + root?: HTMLElement | null |
18 | 17 |
|
19 | 18 | /** |
20 | 19 | * Unique identifier for the root element - This is used to identify the |
21 | 20 | * `IntersectionObserver` instance, so it can be reused. |
22 | 21 | * If you defined a root element, without adding an `id`, it will create a new |
23 | 22 | * instance for all components. |
24 | 23 | */ |
25 | | - rootId?: string; |
| 24 | + rootId?: string |
26 | 25 |
|
27 | 26 | /** |
28 | 27 | * Margin around the root. |
29 | 28 | * Can have values similar to the CSS margin property, |
30 | 29 | * e.g. `"10px 20px 30px 40px"` (top, right, bottom, left). |
31 | 30 | */ |
32 | | - rootMargin?: string; |
| 31 | + rootMargin?: string |
33 | 32 |
|
34 | 33 | /** |
35 | 34 | * Element tag to use for the wrapping component |
36 | 35 | * @default `'div'` |
37 | 36 | */ |
38 | | - tag?: string; |
| 37 | + tag?: string |
39 | 38 |
|
40 | 39 | /** Number between 0 and 1 indicating the the percentage that should be |
41 | 40 | * visible before triggering. Can also be an array of numbers, to create |
42 | 41 | * multiple trigger points. |
43 | 42 | * @default `0` |
44 | 43 | */ |
45 | | - threshold?: number | number[]; |
| 44 | + threshold?: number | number[] |
46 | 45 |
|
47 | 46 | /** |
48 | 47 | * Only trigger this method once |
49 | 48 | * @default `false` |
50 | 49 | */ |
51 | | - triggerOnce?: boolean; |
| 50 | + triggerOnce?: boolean |
52 | 51 |
|
53 | 52 | /** Call this function whenever the in view state changes */ |
54 | | - onChange?(inView: boolean|React.FormEvent<HTMLElement>): void; |
| 53 | + onChange?: (inView: boolean) => void |
55 | 54 |
|
56 | 55 | /** Get a reference to the the inner DOM node */ |
57 | | - innerRef?(element?: HTMLElement): void; |
| 56 | + innerRef?: (element?: HTMLElement) => void |
58 | 57 | } |
59 | 58 |
|
60 | 59 | export default class IntersectionObserver extends React.Component< |
|
0 commit comments