Skip to content

fix(view): properly register and forward state machine event listeners to DotLottieDrawable - #143

Open
Epholy wants to merge 1 commit into
LottieFiles:mainfrom
Epholy:fix/sm-listener
Open

Epholy wants to merge 1 commit into
LottieFiles:mainfrom
Epholy:fix/sm-listener

Conversation

@Epholy

@Epholy Epholy commented Sep 18, 2026

Copy link
Copy Markdown

Problem

In the View implementation of DotLottieAnimation, state machine event listeners are not properly registered.

When DotLottieAnimation.addStateMachineEventListener() is called, mLottieDrawable has not yet been initialized and remains null. As a result, the state machine event listener is never forwarded to the underlying DotLottieDrawable instance.

This issue specifically breaks dotlottie-flutter, causing all state machine-related callbacks to stop functioning, as dotlottie-flutter integrates with the Android View version rather than the Compose component.

Solution

Following the existing pattern used for dotLottieEventListener:

  1. Temporarily store the listener in DotLottieAnimation.mStateMachineEventListener when addStateMachineEventListener() is invoked.
  2. Pass the cached listener as a parameter when creating DotLottieDrawable later.

This ensures that pollAndDispatchAllEvents() can successfully retrieve and dispatch events to the registered state machine listeners.

@changeset-bot

changeset-bot Bot commented Sep 18, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c5ca9ce

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant