Releases: SMAKSS/react-scroll-direction
Release Notes for @smakss/react-scroll-direction v4.1.0
We are excited to announce the release of @smakss/react-scroll-direction
version 4.1.0. This version brings several improvements and bug fixes that enhance the functionality and usability of our React scroll direction detection hook.
What's New
-
Improvements:
- Enhanced the scroll position detection accuracy, especially near page boundaries.
- Updated documentation with more examples and use cases to help developers integrate the hook into their projects more easily.
-
Bug Fixes:
- Fixed an issue where the scroll direction incorrectly reported as "down" when scrolling the page.
Acknowledgments
A big thank you to @astralarya, @KubaZachacz and the community for their continuous support and feedback, which have been invaluable in making this release possible.
What's Changed
Full Changelog: v4.0.4...v4.1.0
v4.0.4-beta.0
Full Changelog: v4.0.3...v4.0.4-beta.0
Upgrade dependencies to their latest stable version
v4.0.4 chore(version): upgrade to stable version 4.0.4
Include types path in package.json
v4.0.3 chore(core): add types path
Include source map
v4.0.2 chore(core): include sourcemap into distribution
Fix package config and distribution
v4.0.1 chore(core): fix package rollup config and distribution
Remove commonjs support
v4.0.0-beta.1 chore(core): remove commonjs support
Add scroll position
v4.0.0-beta.0 feat(scroll-position): add scroll position to the hook return object
Release Notes - Version 4.0.0
Highlights of Version 4.0.0
We are excited to announce the release of version 4.0.0 of the @smakss/react-scroll-direction
hook. This major update brings significant enhancements to the hook, introducing the ability to detect not only the scroll direction but also the precise scroll position within the viewport. This feature is essential for developers looking to create more dynamic and responsive UI interactions in their React applications.
New Features
- Scroll Position Detection: Alongside detecting the scroll direction (up, down, left, right, still), the hook now provides the exact scroll position from the top, bottom, left, and right edges of the viewport. This addition opens up a new realm of possibilities for scroll-based animations and interactions in your application.
- Enhanced TypeScript Support: Improved type definitions for better integration with TypeScript projects.
- Extended Compatibility: Ensures seamless integration with popular frameworks and libraries such as Remix, Next.js, and Gatsby.
Updated API
- The hook now returns an object containing two properties:
scrollDir
andscrollPosition
.scrollDir
gives the direction of the scroll, whilescrollPosition
provides an object withtop
,bottom
,left
, andright
properties, indicating the scroll distance from respective edges of the viewport.
Breaking Changes
- Starting from this version, CommonJS support has been discontinued. The package now only supports ES Module imports. This change is part of our effort to streamline the package and embrace modern JavaScript standards.
- Please note that the return type of the hook has been modified to accommodate the new feature. Ensure to update your implementation to work with the new return type structure.
How to Upgrade
To upgrade to the latest version, run:
npm install @smakss/react-scroll-direction@4.0.0
# or
yarn add @smakss/react-scroll-direction@4.0.0
Example Usage
import useDetectScroll from '@smakss/react-scroll-direction';
function Component() {
const { scrollDir, scrollPosition } = useDetectScroll();
// Use scrollDir and scrollPosition as needed
}
Acknowledgements
Special thanks to our contributors and users for their feedback and suggestions that have shaped this release. Your continued support and engagement are invaluable to the growth of this project.
Stay Connected
For more updates, follow us on GitHub and stay tuned for more exciting features!
Upgrade deps
v3.1.5-beta.0 chore(deps): upgrade deps