1 回答

TA貢獻(xiàn)1779條經(jīng)驗(yàn) 獲得超6個(gè)贊
固定!Android上的z索引似乎存在一些問(wèn)題。為了解決這個(gè)問(wèn)題,我剛剛添加了海拔高度:當(dāng)平臺(tái)是Android時(shí)為1。
請(qǐng)參閱下面的代碼:
<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'}
`);
添加回答
舉報(bào)