Command Palette

Search for a command to run...

dotLottie React Native Player API Reference

API reference for the dotLottie React Native player. Details for the DotLottie component props, Dotlottie ref methods, types, enums, and all supported events.

dotLottie React Native Player API Reference

DotLottie Component Props

Animation Source

PropTypeDescription
sourcestring | number | { uri: string }Animation source: a URI string, a require() asset, or { uri }.

Playback

PropTypeDefaultDescription
autoplaybooleanfalseAuto-starts the animation on load.
loopbooleanfalseWhether the animation loops.
speednumber1Playback speed multiplier.
playModeMode.FORWARD | Mode.REVERSE | Mode.BOUNCE | Mode.REVERSE_BOUNCEMode.FORWARDPlayback direction mode.
segment[number, number]undefinedFrame range to play as [startFrame, endFrame].
markerstringundefinedNamed marker to play.
useFrameInterpolationbooleanundefinedEnable subframe interpolation. Actual default depends on the native renderer.

Rendering

PropTypeDefaultDescription
renderer'sw' | 'gl''sw'Rendering backend. 'sw' = software renderer, 'gl' = OpenGL ES renderer. Android GL support added in v0.8.0.

Theming

PropTypeDefaultDescription
themeIdstringundefinedID of the theme to apply from the .lottie file.

State Machines

PropTypeDefaultDescription
stateMachineIdstringundefinedID of the state machine to load automatically on animation load.

Style

PropTypeDescription
styleViewStyleStyle applied to the animation view.

Event Callbacks

Animation Events

PropSignatureDescription
onLoad() => voidFired when the animation is loaded.
onComplete() => voidFired when playback completes.
onLoadError() => voidFired when loading fails.
onPlay() => voidFired when playback starts.
onPause() => voidFired when playback pauses.
onStop() => voidFired when playback stops.
onFrame(frame: number) => voidFired on each frame update.
onRender(frame: number) => voidFired when a new frame is rendered.
onLoop(loopCount: number) => voidFired when a loop completes.
onFreeze() => voidFired when the animation is frozen.
onUnFreeze() => voidFired when the animation is unfrozen.
onDestroy() => voidFired when the player is destroyed.

State Machine Events

PropSignatureDescription
onStateMachineStart() => voidFired when the state machine starts.
onStateMachineStop() => voidFired when the state machine stops.
onStateMachineStateEntered(state: string) => voidFired when entering a state.
onStateMachineStateExit(state: string) => voidFired when exiting a state.
onStateMachineTransition(from: string, to: string) => voidFired on a state transition.
onStateMachineCustomEvent(event: string) => voidFired on a custom state machine event.
onStateMachineError(error: string) => voidFired when the state machine encounters an error.
onStateMachineInputFired(inputName: string) => voidFired when an input fires.
onStateMachineBooleanInputChange(name: string, oldVal: boolean, newVal: boolean) => voidFired when a boolean input changes.
onStateMachineNumericInputChange(name: string, oldVal: number, newVal: number) => voidFired when a numeric input changes.
onStateMachineStringInputChange(name: string, oldVal: string, newVal: string) => voidFired when a string input changes.

Ref Methods (Dotlottie)

Attach a ref to the DotLottie component to access the controller. The ref type is Dotlottie:

import { DotLottie, type Dotlottie } from '@lottiefiles/dotlottie-react-native';

const controllerRef = useRef<Dotlottie>(null);

Playback Methods

MethodDescription
play()Starts or resumes playback.
pause()Pauses playback.
stop()Stops playback and resets to the first frame.
setFrame(frame: number)Jumps to the specified frame.
setSpeed(speed: number)Sets the playback speed multiplier.
setLoop(loop: boolean)Enables or disables looping.
setPlayMode(mode: Mode)Sets the playback mode.
setSegment(start: number, end: number)Sets the frame range to play.
setMarker(marker: string)Sets the named marker to play.
freeze()Freezes the animation at the current frame.
unfreeze()Unfreezes the animation.
resize(width: number, height: number)Resizes the animation view.

State Queries (Async)

MethodReturn TypeDescription
isPlaying()Promise<boolean>Returns true if currently playing.
isPaused()Promise<boolean>Returns true if paused.
isStopped()Promise<boolean>Returns true if stopped.
isLoaded()Promise<boolean>Returns true if the animation is loaded.
currentFrame()Promise<number>Returns the current frame number.
totalFrames()Promise<number>Returns the total number of frames.
duration()Promise<number>Returns the animation duration in milliseconds.
speed()Promise<number>Returns the current playback speed.
loopCount()Promise<number>Returns the current loop iteration count.
activeThemeId()Promise<string>Returns the ID of the currently active theme.
activeAnimationId()Promise<string>Returns the ID of the currently active animation.

Animation & Theme

MethodDescription
loadAnimation(animationId: string)Loads a specific animation by ID from a multi-animation file.
setTheme(themeId: string)Applies a theme by ID.

State Machine

MethodDescription
stateMachineLoad(stateMachineId: string)Loads a state machine by ID.
stateMachineStart()Starts the loaded state machine.
stateMachineStop()Stops the state machine.
stateMachineFire(event: string)Fires a named event to the state machine.
stateMachineSetBooleanInput(key: string, value: boolean)Sets a boolean input. Returns boolean indicating success.
stateMachineSetNumericInput(key: string, value: number)Sets a numeric input. Returns boolean indicating success.
stateMachineSetStringInput(key: string, value: string)Sets a string input. Returns boolean indicating success.

Types & Enums

Dotlottie

The ref type for the DotLottie component controller. Import it as:

import { type Dotlottie } from '@lottiefiles/dotlottie-react-native';

Renderer

import { type Renderer } from '@lottiefiles/dotlottie-react-native';

type Renderer = 'sw' | 'gl';
  • 'sw' — Software renderer (default)

  • 'gl' — OpenGL ES renderer (Android GL support added in v0.8.0)

Mode

import { Mode } from '@lottiefiles/dotlottie-react-native';

enum Mode {
  FORWARD = 0,
  REVERSE = 1,
  BOUNCE = 2,
  REVERSE_BOUNCE = 3,
}

Platform Differences (Web)

The package includes a web implementation that wraps @lottiefiles/dotlottie-react. The following features are not available on web:

  • setTheme() — use loadTheme() instead on web

  • stateMachineLoad() — use loadStateMachine() instead on web

  • stateMachineFire() — not supported on web

  • stateMachineSetBooleanInput(), stateMachineSetNumericInput(), stateMachineSetStringInput() — not supported on web

  • resize() — ignores width/height parameters on web

  • onDestroy event — not wired on web

  • State machine event callbacks (onStateMachine*) — not supported on web


Last updated: April 10, 2026 at 9:12 AMEdit this page