Absolute and Flexbox in React Native

前端 未结 3 1097
轻奢々
轻奢々 2020-12-23 20:00

I would like to put a white bar which would take all of the width at the bottom of the screen. To do so I thought about using absolute positioning with the inhe

相关标签:
3条回答
  • 2020-12-23 20:35

    The first step would be to add

    position: 'absolute',
    

    then if you want the element full width, add

    left: 0,
    right: 0,
    

    then, if you want to put the element in the bottom, add

    bottom: 0,
    // don't need set top: 0
    

    if you want to position the element at the top, replace bottom: 0 by top: 0

    0 讨论(0)
  • 2020-12-23 20:35

    This solution worked for me:

    tabBarOptions: {
          showIcon: true,
          showLabel: false,
          style: {
            backgroundColor: '#000',
            borderTopLeftRadius: 40,
            borderTopRightRadius: 40,
            position: 'relative',
            zIndex: 2,
            marginTop: -48
          }
      }
    
    0 讨论(0)
  • 2020-12-23 20:55

    Ok, solved my problem, if anyone is passing by here is the answer:

    Just had to add left: 0, and top: 0, to the styles, and yes, I'm tired.

    position: 'absolute',
    left:     0,
    top:      0,
    
    0 讨论(0)
提交回复
热议问题