nativescript-community / ui-lottie

NativeScript plugin to expose Airbnb Lottie
https://github.com/airbnb/lottie-android
Other
177 stars 57 forks source link

iOS 14 renders but doesn't display #68

Closed cbun097 closed 3 years ago

cbun097 commented 3 years ago

The plugin works renders well with any Android devices, on iOS is rendered but it doesn't not display. I tried with iOS emulator ios 12,13 and 14 (iPhone and iPAd) and also giving width and height.

Repo: https://github.com/cbun097/nativescript

Angular: 10 NativeScript: 7

Thanks!

wendt88 commented 3 years ago

+1

bradmartin commented 3 years ago

Can you try calling playAnimation() on your lottieview instance and see if that kicks it off?

wendt88 commented 3 years ago

for me playAnimation() does not kicks it off, but nothing happens and completionBlock never gets called

apsaros commented 3 years ago

Same issue here, running on Vue. Tried with various setups such as autoplay or, like the example below, playAnimation() in the loaded method:

lottieLoaded(args) {
      console.log("lottie loaded", args.object);
      args.object.playAnimation();
      console.log("lottie animating", args.object.isAnimating());
    },

CONSOLE LOG: lottie loaded LottieView(6)
CONSOLE LOG: lottie animating false
luke-hawk commented 3 years ago

Same here, also on Vue!

apsaros commented 3 years ago

Have someone found a solution to this? Any news @bradmartin ?

mcalc001 commented 3 years ago

+1

mcalc001 commented 3 years ago

Looked like its a timing issue -

  lottieLoaded(args) {
    setTimeout(() => {
      args.object.playAnimation();
    }, 500);
  }

will work .

apsaros commented 3 years ago

Great with some workaround @mcalc001, I managed to fix it at my end without the timeout though.

Embarrassing enough, I missed that you had to update the src reference on your LottieViews with res:// If it helps anyone else, the lottie files (json) still resides under App_Resources/iOS, however don't forget to add res:// like so:

src="res://my-lottie-file.json"

bradmartin commented 3 years ago

I've gone ahead and published 5.0.3 with a simple timeout (0) around the playAnimation method which seems to fix the demo apps on iOS 14. Hopefully others can confirm this fixes their apps. It's not perfect but it seems to help in some scenarios.

wendt88 commented 3 years ago

for me it does not solved the problem

bradmartin commented 3 years ago

@wendt88 can you open a new issue with the full extent of your code (package.json, relevant usage of lottie as well)?