-
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
Modernize library #11
Conversation
Nice job |
This is awesome, do you have plans for a hook for this? |
@Noitidart I was toying with that idea. I may submit a PR |
Thank you for your awesome work and help to the community! I want to PR this thing to use your library because I dont think it handles adjust on zoom. https://github.com/theKashey/react-remove-scroll-bar |
I've whipped up a quick test to see if I could create such a hook: https://codesandbox.io/s/react-scrollbar-size-hook-mw6pf Take a look. Since our method of measuring the scrollbar in the component involves adding an element to the DOM, this hook would have to do the same. Not really a problem if it cleans up after itself. The benefit of the hook is that it requires way less from the consumer. Since it manages its own state, consumers can simply invoke the hook to access the scrollbar Any objections to adding a hook to supplement the component, @shawnmcknight? Oh and I realized that we should probably be adding |
No objections at all. I guess we would export both the component and the hook for use? I think as long as we make sure to reuse as much code as possible in both places to maintain consistency this would be a very good update. |
This PR completely updates the library to support React >= 16.8.0. Essentially everything has been rewritten from the ground up. The repo has been converted from JavaScript to TypeScript, all of the tooling has been refreshed and updated, and the component is now a functional component using React hooks.
** Breaking Changes **
The API for the component has changed. It no longer accepts both
onChange
andonLoad
props, instead only using a singleonChange
prop which serves both purposes. Additionally, theonChange
callback no longer accepts an object with property namesscrollbarHeight
andscrollbarWidth
, instead using the shorterheight
andwidth
.