1
votes

React Native use lottie-react-native

My code

import React from 'react'; import { SafeAreaView, StyleSheet, View, Text, } from 'react-native'; import LottieView from 'lottie-react-native';

export default class BasicExample extends React.Component { render() { return (

      <View style={{flex: 1, backgroundColor: 'yellow'}}>  
      <LottieView 
        style={{flex: 1}}
        source={require("../assets/earthlottie.json")} 
        autoPlay 
        loop 
      />
     </View>
     );

}

}

Version

"lottie-react-native": "^3.5.0", "react": "16.13.1", "react-native": "0.63.2"

1

1 Answers

0
votes

Run this command react-native link and it will work. And still App crash try refer link https://github.com/react-native-community/lottie-react-native#readme

And set manual import for Android and IOS