
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@exodus/lottie-react-native
Advanced tools
Lottie component for React Native (iOS and Android)
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.
We've made some significant updates in version 6 that may impact your current setup. To get all the details about these changes, check out the changelog.
Stay informed to ensure a seamless transition to the latest version. Thank you!
lottie-react-native (latest):yarn add lottie-react-native
Go to your ios folder and run:
pod install
Lottie can be used in a declarative way:
import React from 'react';
import LottieView from 'lottie-react-native';
export default function Animation() {
return (
<LottieView source={require('../path/to/animation.json')} autoPlay loop />
);
}
Additionally, there is an imperative API which is sometimes simpler.
import React, { useEffect, useRef } from 'react';
import LottieView from 'lottie-react-native';
export default function AnimationWithImperativeApi() {
const animationRef = useRef<LottieView>(null);
useEffect(() => {
animationRef.current?.play();
// Or set a specific startFrame and endFrame with:
animationRef.current?.play(30, 120);
}, []);
return (
<LottieView
ref={animationRef}
source={require('../path/to/animation.json')}
/>
);
}
Lottie's animation view can be controlled by either React Native Animated or Reanimated API.
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}
/>
);
}
Changing color of layers:
NOTE: This feature may not work properly on Android. We will try fix it soon.
import React from 'react';
import LottieView from 'lottie-react-native';
export default function ChangingColorOfLayers() {
return (
<LottieView
source={require('../path/to/animation.json')}
colorFilters={[
{
keypath: 'button',
color: '#F00000',
},
{
keypath: 'Sending Loader',
color: '#F00000',
},
]}
autoPlay
loop
/>
);
}
.lottie filesYou need to modify your metro.config.js file accordingly by adding lottie extension to the assetExts array:
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
const defaultConfig = getDefaultConfig(__dirname);
/**
* Metro configuration
* https://facebook.github.io/metro/docs/configuration
*
* @type {import('metro-config').MetroConfig}
*/
const config = {
resolver: {
assetExts: [...defaultConfig.resolver.assetExts, 'lottie'],
},
};
module.exports = mergeConfig(getDefaultConfig(__dirname), config);
Create a file in the following path __mocks__/lottieMock.js and add the following code:
module.exports = 'lottie-test-file-stub';
Then add the following to your jest.config.js file:
module.exports = {
...
moduleNameMapper: {
...,
'\\.(lottie)$': '<rootDir>/jest/__mocks__/lottieMock.js',
},
...
}
You can find the full list of props and methods available in our API document. These are the most common ones:
| Prop | Description | Default |
|---|---|---|
source | Mandatory - 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 |
style | Style attributes for the view, as expected in a standard View. | You need to set it manually. Refer to this pull request. |
loop | A boolean flag indicating whether or not the animation should loop. | true |
autoPlay | A boolean flag indicating whether or not the animation should start automatically when mounted. This only affects the imperative API. | false |
colorFilters | An 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.
View more documentation, FAQ, help, examples, and more at airbnb.io/lottie





FAQs
React Native bindings for Lottie
We found that @exodus/lottie-react-native demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 116 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.