chenqingspring / react-lottie

Render After Effects animations on React based on lottie-web
MIT License
1.65k stars 363 forks source link

Unsafe hook componentWillUpdate #77

Open NoriSte opened 5 years ago

NoriSte commented 5 years ago

Hi guys I've just enabled React.strictMode for my app and the only warning I get is related to Lottie

index.js:1446 Warning: Unsafe lifecycle methods were found within a strict-mode tree:
    in StrictMode

componentWillUpdate: Please update the following components to use componentDidUpdate instead: Lottie

Learn more about this warning here:
https://fb.me/react-strict-mode-warnings

That's the indicted code, is there a safe way to remove the hook without compromising how Lottie work?

Thank you for all 😊 Stefano

wpp commented 5 years ago

Since updating to React 16.9.0 I've also been getting this warning and the suggestions:

  • Move data fetching code or side effects to componentDidUpdate.
  • Rename componentWillUpdate to UNSAFEcomponentWillUpdate to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE name will work. To rename all deprecated lifecycles to their new names, you can run npx react-codemod rename-unsafe-lifecycles in your project source folder.
can-kayacan commented 5 years ago

Same issue we need a fix for the react 16.9.0.

PhEEP commented 4 years ago

Could it be moved into componentDidUpdate and compare prevProps? Sorry for the lazy response, but this is also an issue for us as we update our codebase and I just got around to investigating this.

Edit: Ah, it says to do that in the suggestions... 🤕

karlsandin commented 4 years ago

Any update on this?

vaske commented 4 years ago

Guys did you drop further development? You didn't released since 14 Jun 2018

alexandrzavalii commented 4 years ago

is there a replacement for this lib?

mifi commented 4 years ago

I made a complete rewrite using modern hooks: react-lottie-player. No more deprecation warnings!

SaraSadeghnejad commented 11 months ago

use the latest version of lottie ===>>>> lottie-web react-lottie or web-react-lottie are not updated