我正在使用React Native 0.60.5中的z-index问题,这是目前的最新版本。我希望红色框与蓝色框重叠。
我尝试过:
- z-index:红色框为1,蓝色框为-1。
- z-索引:红色框为1000,蓝色框为-1000。
- 红色框没有z-index,蓝色框没有-1。
以上都不是
情况1:
< View
style = {
{
zIndex: 1,
height: 100,
width: 100,
backgroundColor: 'red',
}
}
/> <
View
style = {
{
height: 100,
width: 100,
zIndex: -1,
backgroundColor: 'blue',
position: 'absolute',
}
}
/>
情况2:
< View
style = {
{
zIndex: 1000,
height: 100,
width: 100,
backgroundColor: 'red',
}
}
/> <
View
style = {
{
height: 100,
width: 100,
zIndex: -1000,
backgroundColor: 'blue',
position: 'absolute',
}
}
/>
情况3:
< View
style = {
{
height: 100,
width: 100,
backgroundColor: 'red',
}
}
/> <
View
style = {
{
height: 100,
width: 100,
zIndex: -1,
backgroundColor: 'blue',
position: 'absolute',
}
}
/>
答案 0 :(得分:0)
View
style = {
{
height: 100,
width: 100,
zIndex: -1000,
backgroundColor: 'blue',
position: 'absolute',
top : 10,
left : 0
}
}
/>