android - 升级到 react-native 0.61.0 后,图像会覆盖元素的 backgroundColor
问题描述
将我的应用程序中的 react-native 库从版本 0.59.9 升级到 0.61.0 后,我遇到了非常奇怪的问题。该问题仅发生在 Android(模拟器和设备)上。
首先,我应该提一下,自从第一次打开应用程序以来,这个问题就没有发生过。登录到应用程序后最常出现。处理完数据后,应用程序中元素的呈现会发生意外变化。
问题看起来像:
如您所见,图像覆盖了背景颜色,但奇怪的是它没有覆盖里面的铭文。大家有遇到过这样的问题吗?如何解决?可能是什么原因造成的?
我把代码片段放在下面。我再次强调:在应用程序初始化时不会出现问题,并且在升级库之前一切正常。
const ProfileHead = () => (
<View>
<LinearGradient
colors={["rgba(3, 7, 20, 0)", "#030714"]}
style={styles.backgroundGradient}
start={{ x: 0.0, y: 0.0 }}
end={{ x: 0.0, y: 1.0 }}
locations={[0, 1]}
/>
<Image
source={require("../../assets/images/focusly_08.jpg")}
style={styles.imageBackground}
/>
</View>
);
<MainContainer style={{ paddingTop: 0 }} navbarHidden={true}>
<StretchScroll
stretchHeight={300}
stretchComponent={<ProfileHead />}
style={styles.scroll}
>
<View style={styles.userProfile}>
<ProfileOval title={user.name ? user.name.charAt(0) : ""} />
<Header style={styles.header}>{user.name}</Header>
</View>
...
backgroundGradient: {
position: "absolute",
width: Dimensions.get("window").width,
height: 200,
zIndex: 2,
},
imageBackground: {
width: Dimensions.get("window").width,
position: "absolute",
height: 200,
},
scroll: {
zIndex: 3,
},
userProfile: {
alignItems: "center",
marginTop: 130,
},
解决方案
推荐阅读
- react-native - 反应导航底部选项卡导航器动态更改背景
- javascript - 对打字稿中的数组进行详尽的类型检查
- ios - 为什么 iOS 14 ATT 提示无法在模拟器上运行?
- python - scipy 中的 st.ttest_ind 返回 p 值为 0.0
- c++ - const_cast:仅当原始变量为 const 时,修改以前的 const 值才是未定义的
- python - 如果两个列是相同的 Pandas,则在它们之间添加列
- scrapy - XPath 选择器返回空列表
- visual-studio-2019 - Visual Studio 2019 - Angular 9.1.9 - 没有实时重新加载
- javascript - google fitBounds 无法按预期工作
- google-cloud-dataflow - 状态和输出的原子性