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
Feature: Add useObserveScrollPosition and useScrollTo (#49)
* Add new hooks
* Rename
* Clean up
* Clean up
* Clean up
* Clean up
* Rename and ESLint
* Add useObserveScrollPosition
* Update entry
* Clean up
* Move ESLint out
* Add breaking changes
* Clean up
* Clean up
* Add badge
Copy file name to clipboardExpand all lines: CHANGELOG.md
+22-2Lines changed: 22 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,18 @@
1
1
# Changelog
2
+
2
3
All notable changes to this project will be documented in this file.
3
4
4
5
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
6
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
7
7
8
## [Unreleased]
8
9
9
-
### Added
10
+
### Breaking changes
10
11
11
-
- Added version number to `<meta name="react-scroll-to-bottom:version">` for diagnostic purpose, in PR [#51](https://github.com/compulim/react-scroll-to-bottom/pull/51)
12
+
-`scrollToBottom`/`scrollToEnd`/`scrollToStart`/`scrollToTop` now accept an option `{ behavior: 'auto' | 'smooth' }`
13
+
- Without the option, it is by default to artificial smooth scrolling (`smooth`), to keep existing behavior
14
+
- This behavior may change in the future, by defaulting to discrete scrolling (`auto`), to better align with HTML `DOMElement.scrollIntoView` standard
15
+
- During the transition, please always pass `{ behavior: 'smooth' }` to keep existing behavior
12
16
13
17
### Changed
14
18
@@ -23,6 +27,22 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added version number to `<meta name="react-scroll-to-bottom:version">` for diagnostic purpose, in PR [#51](https://github.com/compulim/react-scroll-to-bottom/pull/51)
33
+
- Added `useAnimatingToEnd` getter to indicate if it is animating towards to the end, in PR [#49](https://github.com/compulim/react-scroll-to-bottom/pull/49)
34
+
- The existing `useAnimating` getter only indicate if it is animating to any scroll positions
35
+
- Added `scrollTo` function to scroll to a specific `scrollTop` value, this is similar to `DOMElement.scrollIntoView()`, in PR [#49](https://github.com/compulim/react-scroll-to-bottom/pull/49)
36
+
- The signature is `scrollTo(scrollTop: number, options: { behavior: 'auto' | 'smooth' })`
37
+
- Pass `{ behavior: 'smooth' }` for synthetic smooth scrolling
38
+
- Added `useObserveScrollTop` hook to observe scroll event, in PR [#49](https://github.com/compulim/react-scroll-to-bottom/pull/49)
39
+
- This effect function will be called rapidly on scroll, please avoid expensive code such as calling setter of `useState` and any code that would cause re-render
40
+
41
+
### Fixed
42
+
43
+
- Cancel scroll animation on mouse wheel or touch gesture, in PR [#49](https://github.com/compulim/react-scroll-to-bottom/pull/49)
44
+
- Calling `scrollTo` should cancel any existing scroll animation, in PR [#49](https://github.com/compulim/react-scroll-to-bottom/pull/49)
React container that will auto scroll to bottom or top if new content is added and viewport is at the bottom, similar to `tail -f`. Otherwise, a "jump to bottom" button will be shown to allow user to quickly jump to bottom.
6
6
@@ -10,7 +10,16 @@ Try out the demo at [https://compulim.github.io/react-scroll-to-bottom/](https:/
10
10
11
11
# Breaking changes
12
12
13
-
Starting from `react-scroll-to-bottom@2`, we requires React 16.8.6 or above. This enable developers to use React Hooks to add features to the scroll view.
13
+
## Upcoming
14
+
15
+
-`scrollToBottom`/`scrollToEnd`/`scrollToStart`/`scrollToTop` now accept an option `{ behavior: 'auto' | 'smooth' }`
16
+
- Without the option, it is by default to artificial smooth scrolling (`smooth`), to keep existing behavior
17
+
- This behavior may change in the future, by defaulting to discrete scrolling (`auto`), to better align with HTML `DOMElement.scrollIntoView` standard
18
+
- During the transition, please always pass `{ behavior: 'smooth' }` to keep existing behavior
19
+
20
+
## [2.0.0] - 2020-05-07
21
+
22
+
- Starting from `react-scroll-to-bottom@2`, we requires React 16.8.6 or above. This enable developers to use React Hooks to add features to the scroll view.
14
23
15
24
# Sample code
16
25
@@ -182,6 +191,11 @@ This context contains functions used to manipulate the container. And will not u
0 commit comments