You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** Number between 0 and 1 indicating the the percentage that should be visible before triggering. Can also be an array of numbers, to create multiple trigger points. */
13
+
threshold?: number|Array<number>,
14
+
/** The HTMLElement that is used as the viewport for checking visibility of the target. Defaults to the browser viewport if not specified or if null.*/
15
+
root?: HTMLElement,
16
+
/** Margin around the root. Can have values similar to the CSS margin property, e.g. "10px 20px 30px 40px" (top, right, bottom, left). */
17
+
rootMargin?: string,
18
+
/** Unique identifier for the root element - This is used to identify the IntersectionObserver instance, so it can be reused.
19
+
* If you defined a root element, without adding an id, it will create a new instance for all components. */
20
+
rootId?: string,
21
+
/** Call this function whenever the in view state changes */
22
+
onChange?: (inView: boolean)=>void,
23
+
/** Use render method to only render content when inView */
24
+
render?: ()=>React.Node,
25
+
}
26
+
27
+
typeState={
28
+
inView: boolean,
29
+
}
6
30
7
31
/**
8
32
* Monitors scroll, and triggers the children function with updated props
/** Number between 0 and 1 indicating the the percentage that should be visible before triggering. Can also be an array of numbers, to create multiple trigger points. */
25
-
threshold: PropTypes.oneOfType([
26
-
PropTypes.arrayOf(PropTypes.number),
27
-
PropTypes.number,
28
-
]),
29
-
/** The HTMLElement that is used as the viewport for checking visibility of the target. Defaults to the browser viewport if not specified or if null.*/
30
-
root: PropTypes.object,
31
-
/** Margin around the root. Can have values similar to the CSS margin property, e.g. "10px 20px 30px 40px" (top, right, bottom, left). */
32
-
rootMargin: PropTypes.string,
33
-
/** Unique identifier for the root element - This is used to identify the IntersectionObserver instance, so it can be reused.
34
-
* If you defined a root element, without adding an id, it will create a new instance for all components. */
35
-
rootId: PropTypes.string,
36
-
/** Call this function whenever the in view state changes */
37
-
onChange: PropTypes.func,
38
-
/** Use render method to only render content when inView */
39
-
render: PropTypes.func,
40
-
}
41
-
40
+
classObserverextendsReact.Component<Props,State>{
42
41
staticdefaultProps={
43
42
tag: 'div',
44
43
threshold: 0,
@@ -49,13 +48,13 @@ class Observer extends Component {
0 commit comments