lottie-react-native Npm / Example / Github / Splash Screen / Expo / Not Playing React Native 

lottie-react-native Npm / Example / Github / Splash Screen / Expo / Not Playing React Native :


iOS and Android

Install lottie-react-native (latest) and lottie-ios (3.4.0):

yarn add lottie-react-native [email protected]


npm i --save lottie-react-native [email protected]

Go to your ios folder and run:

pod install

Windows (React Native >= 0.63)

Install the lottie-react-native npm package.

Add the following to the end of your project file. For C# apps, this should come after any Microsoft.Windows.UI.Xaml.CSharp.targets includes. For C++ apps, it should come after any Microsoft.Cpp.targets includes.

<PropertyGroup Label="LottieReactNativeProps">
    <LottieReactNativeDir>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'node_modules\lottie-react-native\package.json'))\node_modules\lottie-react-native</LottieReactNativeDir>
<ImportGroup Label="LottieReactNativeTargets">
    <Import Project="$(LottieReactNativeDir)\src\windows\cppwinrt\PropertySheets\LottieGen.Auto.targets" />

Add the LottieReactNative.vcxproj file to your Visual Studio solution to ensure it takes part in the build.

For C# apps, you’ll need to install the following packages through NuGet:

  • LottieGen.MsBuild
  • Microsoft.UI.Xaml
  • Win2D.uwp
  • Microsoft.Toolkit.Uwp.UI.Lottie
    • This package is used for loading JSON dynamically. If you only need codegen animation, you can set <EnableLottieDynamicSource>false</EnableLottieDynamicSource> in your project file and omit this reference.

For C++ apps, you’ll need these NuGet packages:

  • LottieGen.MsBuild
  • Microsoft.UI.Xaml

WinUI 2.6 (Microsoft.UI.Xaml 2.6.0) is required by default. Overriding this requires creating a Directory.Build.props file in your project root with a <WinUIVersion> property.

In your application code where you set up your React Native Windows PackageProviders list, add the LottieReactNative provider:

// C#
PackageProviders.Add(new LottieReactNative.ReactPackageProvider(new AnimatedVisuals.LottieCodegenSourceProvider()));
// C++
#include <winrt/LottieReactNative.h>
#include <winrt/AnimatedVisuals.h>



Codegen animations are supported by adding LottieAnimation items to your project file. These will be compiled into your application and available at runtime by name. For example:

<!-- .vcxproj or .csproj -->
    <LottieAnimation Include="Assets/Animations/MyAnimation.json" Name="MyAnimation" />
// js
<LottieView source={"MyAnimation"} />

Codegen is available to both C# and C++ applications. Dynamic loading of JSON strings at runtime is currently only supported in C# applications.


Depending on which version of React Native your app runs on you might need to install a specific version of lottie-react-native. Here’s the compatibility list:

App built in React Native versionRequires lottie-react-native versionRequires lottie-ios version
>= 0.593.
>= 0.604.
>= 0.634.
>= 0.644.
>= 0.66latest3.4.0


(If you are using TypeScript, please read this first)

Lottie can be used in a declarative way:

import React from 'react';
import Lottie from 'lottie-react-native';

export default function Animation() {
  return (
    <Lottie source={require('./animation.json')} autoPlay loop />

Additionally, there is an imperative API which is sometimes simpler.

import React, { useEffect, useRef } from 'react';
import Lottie from 'lottie-react-native';

export default function AnimationWithImperativeApi() {
  const animationRef = useRef<Lottie>(null)
  useEffect(() => {

    // Or set a specific startFrame and endFrame with:
    animationRef.current?.play(30, 120);
  }, [])

  return (

Lottie’s animation progress can be controlled with an Animated value:

import React, { useEffect } from 'react';
import { Animated, Easing } from 'react-native';
import Lottie from 'lottie-react-native';

export default function ControllingAnimationProgress() {
  const animationProgress = useRef(new Animated.Value(0))

  useEffect(() => {
    Animated.timing(animationProgress.current, {
      toValue: 1,
      duration: 5000,
      easing: Easing.linear,
      useNativeDriver: false
  }, [])

  return (

Changing color of layers:

import React from 'react';
import Lottie from 'lottie-react-native';

export default function ChangingColorOfLayers() {
  return (
          keypath: 'button',
          color: '#F00000',
          keypath: 'Sending Loader',
          color: '#F00000',


You can find the full list of props and methods available in our API document. These are the most common ones:

sourceMandatory – The source of animation. Can be referenced as a local asset by a string, or remotely with an object with a uri property, or it can be an actual JS object of an animation, obtained (for example) with something like require('../path/to/animation.json').None
styleStyle attributes for the view, as expected in a standard View.The aspectRatio exported by Bodymovin will be set. Also the width if you haven’t provided a width or height
loopA boolean flag indicating whether or not the animation should loop.true
autoPlayA boolean flag indicating whether or not the animation should start automatically when mounted. This only affects the imperative API.false
colorFiltersAn array of objects denoting layers by KeyPath and a new color filter value (as hex string).[]



Not all After Effects features are supported by Lottie. If you notice there are some layers or animations missing check this list to ensure they are supported.

iOS specific problems

If you have issues linking your iOS project check out this StackOverflow thread on how to fix it.

Android specific problems

If your app crashes on Android, means auto linking didn’t work. You will need to make the following changes:


  • add import com.airbnb.android.react.lottie.LottiePackage; on the imports section
  • add packages.add(new LottiePackage()); in List<ReactPackage> getPackages();


add implementation project(':lottie-react-native') in the dependencies block



include ':lottie-react-native'
project(':lottie-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/lottie-react-native/src/android')

Leave a Comment