felippenardi/lottie-react-web

Animation restarts on component state update

jadbox opened this issue · 4 comments

I'm having a bit of a problem where anytime my component updates due to a state update that the lottie react component animation restarts. The problem happens when the segments property is set.

Can you isolate that problem in a JSFiddle so we can debug?

I've had to give up on lottie-react-web and now I just use lottie-web directly to instance the animation in componentDidMount and set the segments there. Sorry I don't have much time to produce a sample case right now.

@jadbox No problem! I appreciate you reporting this problem. I could reproduce it now and I'll be fixing it.

Sorry, I couldn't work on it quickly, but I'm glad you figured another solution.

Hi !
I wrapped my LottiePicture component with React.memo to prevent animation restart. It seems to work !
Thank's for this library !