DEV Community

Cover image for React Native Lottie Animations
shyam manek
shyam manek

Posted on

React Native Lottie Animations

Lottie is very light weight and easy to use with react native.
also Lottie is good quality and one of the advanced version of gif

Lottie component for React Native (iOS, Android, and Windows)

Lottie is an ecosystem of libraries for parsing Adobe After Effects animations exported as JSON with bodymovin and rendering them natively!

For the first time, designers can create and ship beautiful animations without an engineer painstakingly recreating it by hand.

Lottie npm Package Link

Example

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

const AnimatedLottieView = Animated.createAnimatedComponent(LottieView);

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,
    }).start();
  }, []);

  return (
    <AnimatedLottieView
      source={require('../path/to/animation.json')}
      progress={animationProgress.current}
    />
  );
}
Enter fullscreen mode Exit fullscreen mode

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

API document For Lottie

Top comments (0)