Expo (React Native) <Left> and <Right> work on Android and not on iPhone

201 Views Asked by At

The purpose of the code below is to have texts on a same row in two columns, like a html table. This Expo code works on Android, but Text inside the Left and Right are not showing on the iPhone.

            <Text style={styles.form.title}>Title</Text>
            <View style={{ justifyContent: 'center', }}>
            <Left style={{paddingRight:200}}>
              <Text style={{fontSize:17}}>First row</Text>
              <Text style={{fontSize:17}}>Second row</Text>
           </Left>

            <Right style={{paddingLeft:150, marginBottom:230}}>
              <Text style={{fontSize:17}}>First row</Text>
              <Text style={{fontSize:17}}>Second row</Text>
            </Right>
          </View>
1

There are 1 best solutions below

1
KKK On

What package are you using for the Left and Right components? Maybe that package is not compatible with IOS.

You can just try this one. Im only using react-native components

<View style={{flex: 1}}>
  <Text style={styles.form.title}>Title</Text>
  <View style={{ flexDirection: 'row', flex: 1 }}>
    <View style={{paddingLeft:200, flex: 1}}>
      <Text style={{fontSize:17}}>First row</Text>
      <Text style={{fontSize:17}}>Second row</Text>
    </View>
    <View style={{paddingRight:150, flex: 1}}>
      <Text style={{fontSize:17}}>First row</Text>
      <Text style={{fontSize:17}}>Second row</Text>
    </View>
  </View>
</View>

You can also add backgroundColor just to see the views clearly. Try not to be dependent on packages since some of it are not compatible in all OS and expo.