-
Notifications
You must be signed in to change notification settings - Fork 27
After a few seconds, couldn't scrolling with nextjs #88
Comments
Hi ! Have the same issue right here :/ i tried to use |
I also have the exact same issue, but with reactjs. So, after a bit of tinkering and searching, I found out the problem exists because of React's Strict mode, which is also on by default in nextjs. Now you can turn it off, by setting it to false in the next.config.js file:
This will fix the immediate problem but it defeats the purpose of strict mode, which is a developer tool that helps detect quick re-render issues. So even with strict mode off, if your application is ever re-rendered quickly, the animation will break. So strict mode mimics this to try to get developers to clean up their useEffects. So you need to return a cleanup function that:
For this you'll need to also disable asscroll's default requestAnimationFrame and create your own, so you can stop the animation in the cleanup function. You can also destroy the asscroll instance by setting it to an empty object. |
Thanks @jsskrh that worked well with React/NextJS you need to use a RaF hook instead of the default one from this lib |
Hey. Having the same issue. It happens even with asscroll.disable() in the cleanup function. |
@MetamorphAlex A bit late but this was basically what I did on the clean up function return () => {
asscroll.disable();
asscroll = undefined!;
} |
I used asscroll with nextjs 12.3.0
When loaded, can move, but after a few seconds, it couldn't scrolling
asscroll.mov
please check it
The text was updated successfully, but these errors were encountered: