Questions? Ask in Slack #vcc-ui
@volvo-cars/react-scroll-utils
This package exposes useful utility hooks that can be used to help you with user scrolling concerns.
$ yarn add @volvo-cars/react-scroll-utils
💡 This package includes Typescript definitions
Returns an array with both a ref
and hasScrolled
element.
Name | Description | Type | Default Value |
---|---|---|---|
disabled | If true, hook does not refresh dimensions. Will report the current scroll status if set to false after user has already scrolled. | boolean | false |
offsetThreshold | Use to delay returning true for hasScrolled until the user has scrolled by that amount | number | 0 |
A demonstration implementation can be found in the vcc-ui Storybook.