LottieFiles / lottie-react

lottie web player as a react component
https://lottiefiles.com
MIT License
720 stars 80 forks source link

Ready event dosen't work. #109

Closed mortengustafsson closed 2 years ago

mortengustafsson commented 2 years ago

Overview

It seems like the event ready doesn't work.

onEvent={(event) => {
        if (event === 'ready') ....
}}

If I start an animation and log the events from onEvent - ready never shows up.

...

Consuming repo

What repo were you working in when this issue occurred? ...

Labels

samuelOsborne commented 2 years ago

Will look in to this @mortengustafsson

samuelOsborne commented 2 years ago

In the mean time @mortengustafsson If you're looking to catch when the animation has loaded, use

onEvent={(event) => {
        if (event === 'load') ....
}}
samuelOsborne commented 2 years ago

After investigation, ready isn't fired because we manage fetching the JSON file inside the wrapper, thus lottie-web doesnt need to fetch the data and doesn't fire data_ready so we don't fire ready. As per my previous comment please check for load, and i'll see how we can make this better.

Closing this ticket, thanks for taking the time to submit it!