React Native使用lottie-react-native
从“react”导入React;从“react-native”导入{SafeArea aView, StyleSheet,View,Text,};从“lottie-react-native”导入LottieView;
导出默认类BasicCase扩展React. Component{del(){back(
<View style={{flex: 1, backgroundColor: 'yellow'}}>
<LottieView
style={{flex: 1}}
source={require("../assets/earthlottie.json")}
autoPlay
loop
/>
</View>
);
}
}
版本
"lottie-react-native":"^3.5.0","react":"16.13.1","react-native":"0.63.2"
运行这个命令react-native链接,它将工作。仍然应用程序崩溃尝试参考链接https://github.com/react-native-community/lottie-react-native#readme
并为Android和IOS设置手动导入
我刚刚运行了npm link
并为我做了这件事