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: CHANGELOG.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,25 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
7
7
## [Unreleased]
8
+
### Added
9
+
-`AutoHideFollowButton`: will now hide when it start animating scroll position
10
+
-`BasicScrollToBottom`: will now pass `debounce` and `threshold` to `Composer`, fix [#2](https://github.com/compulim/react-scroll-to-bottom/issues/2)
11
+
-`Composer`: `debounce` prop to control debouncing on `onScroll` event, default to `17`
12
+
-`FunctionContext`: `scrollTo` now support `"bottom"`, in addition to a `number`, fix [#1](https://github.com/compulim/react-scroll-to-bottom/issues/1)
13
+
- This will help when animating scroll position while new content was added to the panel
14
+
-`FunctionContext`: `scrollToStart` function to scroll to the start, depends on `mode`
15
+
-`StateContext`: `animating` returns `true` if the scroll position is being animated
16
+
-`StateContext`: `atStart` indicates if the scroll position is at the start or not, depend on `mode`
17
+
18
+
### Changed
19
+
- Performance improvements
20
+
-`Context` is now separated into `FunctionContext`, `InternalContext` and `StateContext` for better performance and reduce exposure
21
+
-`FunctionContext` is static and only hold functions for manipulating the panel
22
+
-`InternalContext` is static and for internal use (to overcome shortcomings of `React.createRef`)
23
+
-`StateContext` is dynamic and change when scroll position change
24
+
-`StateContext` will now only update if there are any meaningful changes
25
+
- Added `displayName` to context
26
+
-[`lerna`](https://npmjs.com/package/lerna) bumped from `2.11.0` to `3.4.3`
Copy file name to clipboardExpand all lines: README.md
+24-6Lines changed: 24 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,27 +36,45 @@ export default props =>
36
36
| Name | Default | Description |
37
37
| - | - | - |
38
38
|`className`|| Set the class name for the root element |
39
+
|`debounce`|`17`| Set the debounce for tracking the `onScroll` event |
39
40
|`followButtonClassName`|| Set the class name for the follow button |
40
41
|`mode`|`"bottom"`| Set it to `"bottom"` for scroll-to-bottom, `"top"` for scroll-to-top |
41
42
|`scrollViewClassName`|| Set the class name for the container element that house all `props.children`|
42
43
43
44
## Context
44
45
46
+
We use 2 different contexts with different performance characteristics to provide better overall performance. [Function context](#function-context) contains immutable functions. [State context](#state-context) may change when the user scroll the panel.
47
+
48
+
### Function context
49
+
50
+
This context contains functions used to manipulate the container. And will not update throughout the lifetime of the composer.
51
+
52
+
| Name | Type | Description |
53
+
| - | - | - |
54
+
|`scrollTo`| `(scrollTop: number | 'bottom') => void` | Scroll panel to specified position |
55
+
|`scrollToBottom`|`() => void`| Scroll panel to bottom |
56
+
|`scrollToEnd`|`() => void`| Scroll panel to end (depends on `mode`) |
57
+
|`scrollToStart`|`() => void`| Scroll panel to start (depends on `mode`) |
58
+
|`scrollToTop`|`() => void`| Scroll panel to top |
59
+
60
+
### State context
61
+
62
+
This context contains state of the container.
63
+
45
64
| Name | Type | Description |
46
65
| - | - | - |
66
+
|`animating`|`boolean`|`true` if the panel is animating scroll effect |
47
67
|`atBottom`|`boolean`|`true` if the panel is currently near bottom (see `threshold`) |
48
-
|`atEnd`|`boolean`|`true` if the panel is currently near the end (see `mode` and `threshold`|
68
+
|`atEnd`|`boolean`|`true` if the panel is currently near the end (depends on `mode`, see `mode` and `threshold`|
69
+
|`atStart`|`boolean`|`true` if the panel is currently near the start (depends on `mode`, see `threshold`) |
49
70
|`atTop`|`boolean`|`true` if the panel is currently near top (see `threshold`) |
50
71
|`mode`|`string`|`"bottom"` for scroll-to-bottom, `"top"` for scroll-to-top |
51
-
|`scrollTo`|`(scrollTop: number) => void`| Scroll panel to specified position |
52
-
|`scrollToBottom`|`() => void`| Scroll panel to bottom |
53
-
|`scrollToEnd`|`() => void`| Scroll panel to end |
54
-
|`scrollToTop`|`() => void`| Scroll panel to top |
55
72
|`threshold`|`number`| Threshold in pixels to consider the panel is near top/bottom, read-only and only set thru `props`|
56
73
57
74
# Road map
58
75
59
-
* Easier customization for "scroll to bottom" button
76
+
-[x] Easier customization for "scroll to bottom" button
77
+
-[ ] Debounce on showing "scroll to bottom" button
0 commit comments