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
-**ref:**`RefObject<HTMLElement>`, container which set as `overflow: scroll`.
71
+
-**ref:**`RefObject<HTMLElement>`, container which set as `overflow: scroll`, if scroll whole document, pass `ref = useRef(document.documentElement)` or `useRef(document.body)`.
66
72
-**speed:** Distance in one frame to move in `requestAnimationFrame` mode, defaults to `100`, if not provide, speed depends on native API `scrollTo`.
67
-
-**direction:** Scroll direction
73
+
-**direction:** Scroll direction, `x` for horizontal or `y` for vertical.
68
74
-**threshold:** Judge scroll is finished has an error range, .defaults to `1`.
69
75
70
-
### Returns of Hook
76
+
####Returns of Hook
71
77
72
78
-**scrollTo**`(string|number) => void`
73
79
74
80
- Pass `number`: the distance to scroll, e.g. `scrollTo(400)`
75
81
- Pass `string`: the element seletor you want to scrollTo, meanwhile passing to `document.querySelector`, e.g. `scrollTo('#your-dom-id')`
76
82
77
-
-**reachTop**`boolean`: Whether it has reached the top of scrollContainer
83
+
-**reachedTop**`boolean`: Whether it has reached the top of refContainer
78
84
79
-
-**reachBottom**`boolean`: Whether it has reached the bottom of scrollContainer
85
+
-**reachedBottom**`boolean`: Whether it has reached the bottom of refContainer
80
86
81
87
-**scrollToPage**`(number) => void`: Pass page(`number`), which scroll to a distance as multiples of container size(`offsetWidth`/`offsetHeight`)
82
88
.e.g `scrollToPage(1)`,`scrollToPage(-1)`
83
89
84
-
-**refreshState**`() => void`: Manually refresh the state of `reachTop` and `reachBottom`, just an API as you need, and possibly useful in some situation.
90
+
-**refreshState**`() => void`: Manually refresh the state of `reachTop` and `reachBottom`, possibly useful in some situation.
91
+
92
+
-**refreshSize**`() => void`: Manually refresh the size of ref container, possibly useful in some situation.
Proviede a `list` of dom like below, and pass the parent container `ref` to hook, it return the scrollbar current state of `scrollTop`, `curIndex`, `curItem`.
0 commit comments