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
Copy file name to clipboardExpand all lines: README.md
+11-4Lines changed: 11 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ This is a React component that provides an API to the [scrollMonitor](https://gi
4
4
5
5
It adds all the boolean properties from a watcher to `this.props` and takes all the method properties as properties.
6
6
7
-
Scrollmonitor-react is two higher order components. They're functions that your pass an original component and receive a new component that adds functionality to the original.
7
+
Scrollmonitor-react is two higher order components. They're functions that you pass an original component and receive a new component that adds functionality to the original.
By default the watcher is started on every enhanced component, but there can be situations where you want to start the watcher later so you can set the prop `autoStart` to `false` to avoid starting the watcher automatically.
*`this.props.isBelowViewport` - true if any part of the element is below the viewport.
62
66
*`this.props.lockWatcher()` - locks the watcher letting you move the element but watch the same place. See the scrollMonitor's documentation for more info.
63
67
*`this.props.unlockWatcher()` - unlocks the watcher.
68
+
*`this.props.startWatcher()` - starts the watcher if it's not running
69
+
*`this.props.stopWatcher()` - stops the watcher if it's running
64
70
65
71
_1. If the element is larger than the viewport `isFullyInViewport` is true when the element spans the entire viewport._
66
72
67
-
### Propeties you provide to the component
73
+
### Properties you provide to the component
68
74
69
75
```javascript
70
76
<MyWatchedComponent
77
+
autoStart={true|false} // Decide if watcher should start when component is mounted. Default: true
71
78
stateChange={() => {}} // Called when any part of the state changes.
72
79
visibilityChange={() => {}} // when the element partially enters or fully exits the viewport.
73
80
enterViewport={() => {}} // when the element enters the viewport.
@@ -79,7 +86,7 @@ _1. If the element is larger than the viewport `isFullyInViewport` is true when
79
86
</MyWatchedComponent>
80
87
```
81
88
82
-
_1. If the element is larger than the viewport `fullyEnterViewport` will be triggered when the element spans the entire viewport._
89
+
_1. If the element is larger than the viewport `fullyEnterViewport` will be triggered when the element spans the entire viewport._
83
90
_2. If the element is larger than the viewport `partiallyExitViewport` will be triggered when the element no longer spans the entire viewport._
0 commit comments