Gamote / lottie-react

A lightweight React library for rendering complex After Effects animations in real time using Lottie.
https://lottiereact.com
Other
794 stars 58 forks source link

Issue with next js 13 #91

Closed poornima-alugubelly closed 1 year ago

poornima-alugubelly commented 1 year ago

When trying to use lottie-react with next js 13 , getting the following error: Unhandled Runtime Error TypeError: Cannot read properties of undefined (reading 'length')

image

Steps to reproduce the behavior:

  1. Install lottie-react in a next js project
  2. Try doing a basic implementation
  3. Example: <Lottie animationData={ "https://assets6.lottiefiles.com/packages/lf20_k56tZILcig.json" } loop={true} />

The lottie is supposed to play but doesn't

JoeyKerkdijk commented 1 year ago

Have you tried loading the animationData as JSON instead of loading it from an URL? I think loading from an URL is not supported in v2.

See: https://github.com/Gamote/lottie-react/issues/16

poornima-alugubelly commented 1 year ago

@JoeyKerkdijk Hey yes that was exactly the issue , I tried with the JSON and it worked