1 回答

TA贡献1779条经验 获得超6个赞
固定!Android上的z索引似乎存在一些问题。为了解决这个问题,我刚刚添加了海拔高度:当平台是Android时为1。
请参阅下面的代码:
<Wrapper
isAndroid={Platform.OS === 'android'}
style={{
transform: [
{
translateY: translateValue.interpolate({
inputRange: [0, 1],
outputRange: [300, 0]
})
}
]
}}>
<Content>
<Icon name={icons[type]} size={20} color={primary} />
<Message>{message}</Message>
</Content>
<Button
onPress={handleClose}
accessible
accessibilityRole="button"
accessibilityLabel="Fechar notificação">
<Icon size={20} name="x" color={textGray} />
</Button>
</Wrapper>
);
const Wrapper = Animated.createAnimatedComponent(styled.SafeAreaView`
width: 100%;
border-top-width: 1px;
border-top-color: ${({ theme: { border } }) => border};
background: ${({ theme: { background } }) => background};
z-index: 1;
position: absolute;
flex-direction: row;
justify-content: space-between;
align-items: center;
bottom: 0;
left: 0;
${({ isAndroid }) => isAndroid && 'elevation: 1'}
`);
没有找到匹配的内容?试试慕课网站内搜索吧
添加回答
举报