0

I am trying to build a view with two rows in an iPhone using react native. I want to have two rows with equal height with scroll view. I am not able to find much documentation on this. I am the below code but it just renders on top of each other.

      <View style={Styles.splitView}>
        <View style={Styles.splitViewLeft}>
          <ScrollView>
              <Text>Test1</Text>}
          </ScrollView>
        </View>
        <View style={Styles.splitViewRight}>
          <ScrollView>
            {
              <Text>Test2</Text>
            }
          </ScrollView>
        </View>
      </View>

      splitView: {
        flexDirection: 'row'
      },

      splitViewLeft: {
        flex: 3
      },

      splitViewRight: {
        flex: 2
      },

1 Answer 1

1

This does the work:

<View style={{flex: 1}}>
  <ScrollView style={{flex: 1, backgroundColor: 'red'}}>
    <Text>Test1</Text>
  </ScrollView>
  <ScrollView style={{flex: 1, backgroundColor: 'yellow'}}>
    <Text>Test2</Text>
  </ScrollView>
</View>

Apply style flex: 1 on both <ScrollView /> to make them equal height.

If you wrap it inside parent <View />, you have to apply flex: 1 to <ScrollView /> too.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.