-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to use via custom hook #263
Conversation
@kgregory I would appreciate it if you could give this one a review. |
@Noitidart tagging you since you had asked about this feature. |
Thank you. @shawnmcknight - checking now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some nits :) Thanks for this amazing work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
I like @Noitidart's suggestion for local state. I also think it may be best to heed the React warning about referencing a ref's value in the useEffect cleanup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, found a typo that I missed in the initial review, but I'm approving.
Thanks for the review @kgregory and @Noitidart ! |
Description 📝
This PR adds a custom hook
useScrollbarSize
to the exports from the package. The existing component syntax was retained for backwards compatibility, but will be deprecated in a future major release (likely 4.0).Conceptually, the hook works identically to the component in that it will measure the scrollbar sizes and react to changes which might affect the size of the scrollbar (e.g. change to browser zoom factor). This is intended merely as a usability enhancement as use of the hook is significantly easier than use of the component.
All examples and guides have been updated to favor using the hook instead of the component
Type of change 💎
Example code 📜
See changes to README.md for updated examples.
How Has This Been Tested? 🚦
Checklist 🏁