reactjs - 动画图像没有透明背景
问题描述
在我的 react-native 应用程序中,我想将旋转徽标呈现为屏幕的正确标题。
<Stack.Screen
name="About"
component={About}
options={{headerRight: () => <SpinnerIcon />}}
/>
微调器组件返回一个Animated.Image
<Animated.Image
source={require('../img/reactLogoTwo.png')}
style={[{width: 50, height: 50}, {transform: [{rotate}]}]}
/>
我保存在img
文件夹中的图像具有透明背景(从此处下载),但动画图像呈现为白色背景。
注意:添加backgroundColor: 'transparent'
不起作用。
解决方案
我把这个例子当作零食:https ://snack.expo.io/@zvona/animated-transparent-image
根据它,透明 PNG 和Animated.Image
. 你在使用react-native-animated库吗?
其次,设置风格backgroundColor: 'transparent'
可能会有所帮助,但我看不出是什么导致了这种特殊行为。
推荐阅读
- oracle - 选择查询的自定义异常处理
- php - Laravel 登录页面重定向到验证页面
- html - 当显示一个包含一个单元格的简单表格时,表格显示的大小大约是它应该显示的大小的两倍
- reactjs - 我应该什么时候创建一个新的 React 组件?
- python - 摩根指纹rdkit
- visual-studio - 在 Visual Studio 中更新 Nuget 包后构建定义未构建
- javascript - 如何从数组中提取对象?
- javascript - JavaScript 表格在加载/刷新时闪烁。想知道我怎样才能避免这种情况发生?
- r - 如何在r中的nnfor包中获得mlp层神经元的权重?
- ruby-on-rails - 为什么 Heroku 上的 secret_key_base 为空白(Rails 5.2)