reactjs - Lottie Animation showing with no colour React Native
问题描述
I have Lottie React Native working perfectly in my project except for one minor issue. The colour of the animation is not appearing and I cannot seem to identify what the cause is here. The component is very simple
import React from 'react';
import {StyleSheet, View, Text} from 'react-native';
const styles = StyleSheet.create({
text: {
fontFamily: 'Roboto-Bold',
fontSize: 18,
},
});
export default (props) => {
return (
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
<Text style={styles.text}>Login Screen</Text>
</View>
);
};
Can see here in this that the background of the animation is white when it should have a background colour set: https://lottiefiles.com/7825-money-transfer. Any thoughts/guidance is appreciated.
解决方案
Here is the working example Snack link: https://snack.expo.io/@msbot01/forlorn-raspberries
import React, { Component } from 'react';
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
import LottieView from 'lottie-react-native';
export default class NoNetwork extends Component {
render() {
return (
<View style={{ flex: 1, backgroundColor:'green' }}>
<LottieView source={require('./pay.json')} autoPlay loop />
</View>
);
}
}
const styles = StyleSheet.create({});
推荐阅读
- docker - Docker-Compose NFS 远程挂载正在修改 ZFS NFS 服务器共享上的权限
- html - 如何从 .txt 文件中获取 HTML 并在 [InnerHtml] Angular 8 中解释它
- python - TypeError:不可散列的类型:'ListWidgetItem'
- python - 如何在带有 Flask 的 SQLAlchemy 中使用 ExcludeConstraint
- android - 如何在工作人员中获得我的共享偏好
- java - 如何同时等待不同的事件
- swift - tableView 使用 UIImages 渲染缓慢
- cucumber - 使用 Cypress 和 Cucumber 验证对话框上的文本
- angular - 将 Angular 8 应用程序与 Azure SSO 集成时遇到一些错误
- amazon-web-services - 模板错误:Fn::GetAtt 实例引用未定义资源 EventHandlerLambdaFunction