This repository has been archived by the owner on Dec 22, 2023. It is now read-only.
Releases: thebuilder/react-scroll-percentage
Releases · thebuilder/react-scroll-percentage
v4.2.0
v4.1.0
v4.0.7
This is just some releases trying to streamline the publish process. No actual changes. :)
4.0.6...v4.0.7
v4.0.4
TypeScript and Hooks!
This is a complete rewrite of the library. 🎉
New features
- Rewritten in TypeScript
- Added
useScrollPercentage
hook - Added render props component
If you were using an old version, make sure to consult the updated readme to see how the API has changed.
Update React Intersection Observer
This updates the version of react-intersection-observer
and improves tests.
The API haven't changed, so you shouldn't need to update anything.
v1.0.0
Flow support
Breaking changes
The children()
and onChange
method has been changed, so they receive two arguments instead of an object.
Child as function
import ScrollPercentage from 'react-scroll-percentage'
<ScrollPercentage>
{(percentage, inView ) => (
<h2>{`Percentage scrolled: ${percentage.toPrecision(2)}%.`}</h2>
)}
</ScrollPercentage>
OnChange callback
import ScrollPercentage from 'react-scroll-percentage'
<ScrollPercentage onChange={(percentage, inView) => console.log(percentage, inView)}>
<h2>
Plain children are always rendered. Use onChange to monitor state.
</h2>
</ScrollPercentage>