framer-motion-hooks icon indicating copy to clipboard operation
framer-motion-hooks copied to clipboard

Scroll jump using useInViewScroll

Open matiasbacelar98 opened this issue 3 years ago • 4 comments

I am using this hook to create a parallax effect in an image and when the component is mounted there is a jump in the image the first time the scroll is executed, the strange thing is that the jump only happens if the scroll position does not start at 0 , It is the first time that I use useTransform so I do not know if it will be my error

Example => https://codesandbox.io/s/framer-motion-parallax-img-nb6h2?file=/src/App.js:202-252

matiasbacelar98 avatar Jan 01 '22 23:01 matiasbacelar98

Thank you for reporting. This was a bug in the package's internal implementation and got fixed in the latest commit. You can now safely upgrade to the latest version [email protected].

Let me know if this resolved your issue.

matthiaaas avatar Jan 02 '22 13:01 matthiaaas

Hi , I already updated to the new version but the jump continues to occur, I am adding the reference to the image I don't know if the problem is that when the values ​​of the image are calculated it is not loaded yet, maybe trying to use useLayoutEffect when the values ​​are calculated ?

matiasbacelar98 avatar Jan 02 '22 14:01 matiasbacelar98

What happens if you hardcode the image's dimensions in advance?

matthiaaas avatar Jan 02 '22 20:01 matthiaaas

I tried but it didn't work

matiasbacelar98 avatar Jan 02 '22 21:01 matiasbacelar98