airbnb / lottie-android

Render After Effects animations natively on Android and iOS, Web, and React Native
http://airbnb.io/lottie/
Apache License 2.0
34.96k stars 5.4k forks source link

Animation stops after turning screen off and on. #2431

Closed Drjacky closed 8 months ago

Drjacky commented 9 months ago

Link to fork with a repro in the issue-repro module https://github.com/Drjacky/MVVMTemplate/issues/56

Describe the bug Animation stops after turning the screen off and on.

Steps To Reproduce Steps to reproduce the behaviour:

  1. Disconnect the internet
  2. Click on Coroutine Button
  3. It displays the No Internet Lottie animation
  4. Turn the screen off
  5. Turn the screen on
  6. There is no Lottie animation anymore!

I tested with Lottie 4.2.2 and 6.2.0 and it exists.

gpeal commented 8 months ago

Your problem actually has nothing to do with Lottie at all. If you notice, the "No internet" and retry button don't appear either.

Your issue is that you're using your collectIn function on Flow<Failure>. When you resume, your productsListByCoroutine flow emits paging data which then clears the loading ui. However, your failure flow never re-emits.

Drjacky commented 8 months ago

and retry button don't appear either.

You're right! __ The issue was one extra call on loadingUI(false) and misplace of binding.inclItemError.itemErrorContainer.gone()