Scroll to a position in React
window
not foundFix types with Typescript when using <ScrollArea /> #98
Introducing a new API for React-Scroll-To that'll allow more flexibility!
#56
Notable features:
scroll
and scrollById
functions to be a singular scrollTo
functionscrollTo()
not accepts an object that allows some fields to be left out (No longer need to include the 'x' position if we're only scrolling by 'y')Example:
scrollTo({
x: 25 // The horizontal x position to scroll to
y: 10 // The vertical y position to scroll to
id: "myId" // The ID of the ScrollArea we want to scroll
ref: refObj // A reference to a component to scroll
smooth: true // If true, this will animate the scroll to be smooth. False will give an instant scroll. (defaults: false)
});
Docs: https://github.com/ganderzz/react-scroll-to/tree/release/2.0.0
Prerelease of the 2.0.0 features.
scrollTo
<ScrollArea />
component