jossmac / react-scrolllock

🔒 Prevent scroll on the <body />
https://jossmac.github.io/react-scrolllock
MIT License
451 stars 43 forks source link

body remains locked if more than 1 ScrollLock instance is renderered #17

Closed cloud-walker closed 6 years ago

cloud-walker commented 6 years ago

If you render 2 or more ScrollLock components, you end up with a permanently locked body, even unmounting them.

Here a codesandbox example: https://codesandbox.io/s/q2l94npn9

jossmac commented 6 years ago

@cloud-walker so something weird happens when they're mounted together like that, but in a more likely scenario they play nicely together https://codesandbox.io/s/8kr8nnlpm2

If you'd like to submit a PR I'd be grateful

jossmac commented 6 years ago

@cloud-walker could you checkout #28?

jossmac commented 6 years ago

Oh, sorry mate, never mind. Just saw https://github.com/cloud-walker/react-web-scrolllock

cloud-walker commented 6 years ago

I was experimenting, I've realized that there is not perfect solution to the problem, I'm blocked right now, and for now I use a custom implementation inside the company code.

BTW I'm happy to help to find a better solution 👍