absolute绝对定位的元素显示不出来的可能原因

在父元素position: relative相对定位后

对子元素position: absolute绝对定位,如果没有指定width,会显示空白,当然,如果同时设置left和right,相当于会默认计算一个width,所以也可以正常显示

        <View
          style={
   
   {
            position: 'absolute',
            width: '100%',
            left: 0,
            // right: 0,
            bottom: system.isIphoneX ? screen.iPhoneXBottom : 0,
            height: 45,
          }}
        >

猜你喜欢

转载自blog.csdn.net/hzxOnlineOk/article/details/107865176