react-cube-navigation icon indicating copy to clipboard operation
react-cube-navigation copied to clipboard

LockScrolling false doesn't disable the scroll lock

Open tchappel opened this issue 5 years ago • 2 comments

When I pass to Cube the prop lockScrolling={false} the behaviour is same as lockScrolling={true}

tchappel avatar Jun 29 '20 21:06 tchappel

Hey! I had the same issue. I looked into the source code and found the problem at: line 82 in Cube.tsx: useScrollLock(animating || lockScrolling);

It seems like animating in the (animating || lockScrolling)-expression stays 'true' even when nothing is animating.

I managed to do a dirty fix by applying this change in \node_modules\react-cube-navigation\esm\Cube.js: useScrollLock(animating || lockScrolling); to useScrollLock(lockScrolling);, Run npm i to apply the changes.

I have not analysed the code deep enough to understand the animation-logic but further work should be done to make the animating-variable hold the correct boolean when nothing is animating!

siavashhanifi avatar Jul 28 '20 14:07 siavashhanifi

@siavashhanifi 's change works but it causes unwanted scrolls while swiping the cube.

Nuzair46 avatar Aug 31 '21 04:08 Nuzair46