lottie-react-native: Animations not showing on iOS
Hi,
I’ve installed lottie-react-native and setup the code examples using the animation data, but it’s just showing a blank screen and giving no error. Could you please let me know if I’ve missed any steps? (For example, do I need to install Lottie for iOS independently?)
Many thanks in advance for your help, and for the library, it looks awesome if I can get it up and running!
I ran:
npm install --save lottie-react-native
then to meet the required deps:
npm install --save react-native@0.35
npm install --save-dev babel-preset-airbnb
Then, using the code from the docs, where path/to/animation.json is a valid path to the animation data copied from the example project:
import React from 'react';
import Animation from 'lottie-react-native';
export default class BasicExample extends React.Component {
componentDidMount() {
this.animation.play();
}
render() {
return (
<Animation
ref={animation => { this.animation = animation; }}
style={{
width: 200,
height: 200,
}}
source={require('../path/to/animation.json')}
/>
);
}
}
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 9
- Comments: 21
You have to remove LibLottie.a from linked iOS dependencies. See an example running here : https://github.com/g3r4n/react-native-lottie-example
+1, works ok on android, build success but no animation play on ios