Search code examples
cssreactjsreact-nativeflexboxreact-native-flexbox

Vertically Stacked Views with Static and Dynamic Heights - React Native


I am trying to acheive what the image below represents with Flexbox in React Native with Views, if you have a basic example of this that would be amazing:

enter image description here


Solution

  • Something like this:

    <View style={{ flex: 1, flexDirection: 'column'}}>
      <View style={{ height: 70, backgroundColor: 'blue' }}>
      </View>
      <View style={{ height: 70, backgroundColor: 'green' }}>
      </View>
      <View style={{ flex: 1, backgroundColor: 'yellow' }}>
      </View>
    </View>
    

    Not sure if the blue lines are lines / padding / etc, but you should be able to add those into this shell.