
Security News
PEP 810 Proposes Explicit Lazy Imports for Python 3.15
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
@bam.tech/lottie-react-native
Advanced tools
React Native bindings for Lottie (fork to fix xCode 10 waiting for upstream to release merged PR)
Lottie component for React Native (iOS and Android)
Lottie is a mobile library for Android and iOS that parses Adobe After Effects animations exported as JSON with bodymovin and renders them natively on mobile!
For the first time, designers can create and ship beautiful animations without an engineer painstakingly recreating it by hand.
Get started with Lottie by installing the node module with yarn or npm:
yarn add lottie-react-native
or
npm i --save lottie-react-native
Use react-native link
to add the library to your project:
react-native link lottie-ios
react-native link lottie-react-native
After this, open the Xcode project configuration and add the Lottie.framework
as Embedded Binaries
.
For android, you can react-native link
as well:
react-native link lottie-react-native
LottieView can be used in a declarative way:
import React from 'react';
import LottieView from 'lottie-react-native';
export default class BasicExample extends React.Component {
render() {
return (
<LottieView
source={require('./animation.json')}
autoPlay
loop
/>
);
}
}
Additionally, there is an imperative API which is sometimes simpler.
import React from 'react';
import LottieView from 'lottie-react-native';
export default class BasicExample extends React.Component {
componentDidMount() {
this.animation.play();
// Or set a specific startFrame and endFrame with:
this.animation.play(30, 120);
}
render() {
return (
<LottieView
ref={animation => {
this.animation = animation;
}}
source={require('../path/to/animation.json')}
/>
);
}
}
Lottie's animation progress can be controlled with an Animated
value:
import React from 'react';
import { Animated, Easing } from 'react-native';
import LottieView from 'lottie-react-native';
export default class BasicExample extends React.Component {
constructor(props) {
super(props);
this.state = {
progress: new Animated.Value(0),
};
}
componentDidMount() {
Animated.timing(this.state.progress, {
toValue: 1,
duration: 5000,
easing: Easing.linear,
}).start();
}
render() {
return (
<LottieView source={require('../path/to/animation.json')} progress={this.state.progress} />
);
}
}
You can find The full list of props and methods available in our API document. These are the most commont ones:
Prop | Description | Default |
---|---|---|
source | Mandatory - The source of animation. This must be a JS object of an animation, obtained (for example) with something like require('../path/to/animation.json') . This is needed in order to fix things. | None |
style | Style 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 |
loop | A boolean flag indicating whether or not the animation should loop. | false |
autoPlay | A boolean flag indicating whether or not the animation should start automatically when mounted. This only affects the imperative API. | false |
View more documentation, FAQ, help, examples, and more at airbnb.io/lottie
2.5.10 (November 6, 2018)
FAQs
React Native bindings for Lottie (fork to fix xCode 10 waiting for upstream to release merged PR)
The npm package @bam.tech/lottie-react-native receives a total of 8 weekly downloads. As such, @bam.tech/lottie-react-native popularity was classified as not popular.
We found that @bam.tech/lottie-react-native demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 11 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
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.