Skip to content

[3.0.0] - 2020-06-22

Compare
Choose a tag to compare
@github-actions github-actions released this 14 May 01:03

Breaking changes

  • scrollToBottom/scrollToEnd/scrollToStart/scrollToTop now accept an option { behavior: 'auto' | 'smooth' }
    • Without the option, it is by default to artificial smooth scrolling (smooth), to keep existing behavior
    • This behavior may change in the future, by defaulting to discrete scrolling (auto), to better align with HTML DOMElement.scrollIntoView standard
    • During the transition, please always pass { behavior: 'smooth' } to keep existing behavior

Changed

Added

  • Added version number to <meta name="react-scroll-to-bottom:version"> for diagnostic purpose, in PR #51
  • Added useAnimatingToEnd getter to indicate if it is animating towards to the end, in PR #49
    • The existing useAnimating getter only indicate if it is animating to any scroll positions
  • Added scrollTo function to scroll to a specific scrollTop value, this is similar to DOMElement.scrollIntoView(), in PR #49
    • The signature is scrollTo(scrollTop: number, options: { behavior: 'auto' | 'smooth' })
    • Pass { behavior: 'smooth' } for synthetic smooth scrolling
  • Added useObserveScrollTop hook to observe scroll event, in PR #49
    • 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

Fixed

  • Cancel scroll animation on mouse wheel or touch gesture, in PR #49
  • Calling scrollTo should cancel any existing scroll animation, in PR #49