Skip to content

fix(lottie): forward native ref while preserving imperative methods#272

Merged
gronxb merged 2 commits intomainfrom
fix/lottie-ref
Apr 15, 2026
Merged

fix(lottie): forward native ref while preserving imperative methods#272
gronxb merged 2 commits intomainfrom
fix/lottie-ref

Conversation

@gronxb
Copy link
Copy Markdown
Collaborator

@gronxb gronxb commented Apr 15, 2026

What

This updates the ref handling in packages/ lottie/src/GraniteLottieView.tsx.

Previously, forwardRef exposed an imperative
handle object with only play, pause,
resume, and reset.
That meant the ref was not the actual native
component instance, which could break usage
patterns that expect a native view ref.

This change:

  • forwards the actual
    NativeGraniteLottieView instance
  • preserves the existing play/pause/resume/ reset methods by attaching them to that
    instance
  • handles both function refs and object refs
    consistently, including cleanup on unmount

Why

The previous implementation supported the
imperative Lottie API, but it did not preserve
native ref compatibility.

This change keeps the current control API
intact while making the forwarded ref behave
like a native component ref.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
granite-docs Ready Ready Preview, Comment Apr 15, 2026 8:45am

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 15, 2026

🦋 Changeset detected

Latest commit: a6f57b9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 26 packages
Name Type
@granite-js/lottie Patch
@granite-js/native Patch
@granite-js/blur-view Patch
@granite-js/jest Patch
@granite-js/react-native Patch
@granite-js/style-utils Patch
babel-preset-granite Patch
create-granite-app Patch
@granite-js/cli Patch
@granite-js/cookies Patch
@granite-js/screen Patch
@granite-js/image Patch
@granite-js/mpack Patch
@granite-js/naver-map Patch
@granite-js/plugin-core Patch
@granite-js/plugin-env Patch
@granite-js/plugin-hermes Patch
@granite-js/plugin-micro-frontend Patch
@granite-js/plugin-router Patch
@granite-js/plugin-rozenite Patch
@granite-js/plugin-sentry Patch
@granite-js/utils Patch
@granite-js/video Patch
@granite-js/deployment-manager Patch
@granite-js/forge-cli Patch
@granite-js/pulumi-aws Patch

Not sure what this means? Click here to learn what changesets are.

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

@gronxb gronxb changed the title fix: lottie props fix(lottie): forward native ref while preserving imperative methods Apr 15, 2026
@gronxb gronxb merged commit 6803c3e into main Apr 15, 2026
7 checks passed
@gronxb gronxb deleted the fix/lottie-ref branch April 15, 2026 09:04
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.

2 participants