Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

onAnimationFinish called twice when autoPlay=true and system animations are disabled #1373

Open
Labels
staleThere has been a lack of activity on this issue and it may be closed soon.
@sookcha

Description

@sookcha

Description

Problem

twice.webm

The onAnimationFinish callback is being called twice when autoPlay=true and system animations are disabled.

It is known that when autoPlay is enabled, we should not explicitly call runAnimation, as doing so can cause the animation to play twice. This issue has been documented in the past — for example, see:
airbnb/lottie-android#1500

However, in lottie-react-native, runAnimation is being called even when autoPlay is enabled. This likely results in duplicated animation playback.

Relevant code:

autoPlay?.let {
if (it&&!view.isAnimating) {
view.playAnimation()
}
}

Additionally, I noticed that the autoPlay prop is correctly passed to the native Lottie module:

@JvmStatic
funsetAutoPlay(
autoPlay:Boolean,
viewManager:LottieAnimationViewPropertyManager
) {
viewManager.autoPlay= autoPlay
}

Proposed solution

  • Remove the explicit call to runAnimation when autoPlay is enabled.

Steps to reproduce

  1. Go to phone Settings -> A11y -> Use reduced motion (or remove animation, depending on the phone)
  2. Run sample repo
  3. See duplicated onAnimationFinished log

Snack or a link to a repository

https://github.com/sookcha/lottie-react-native/tree/master/example

Lottie React Native version

7.3.3

React Native version

0.78.3

Platforms

Android

Workflow

React Native

Architecture

Old Architecture

Build type

Debug app & dev bundle

Device

Android emulator

Acknowledgements

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp