世博会(React Native) <Left> 并在<Right>Android而不是iPhone上工作



下面代码的目的是将文本放在同一行的两列中,就像html表一样。这个Expo代码可以在Android上工作,但是左边和右边的文本不能在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>

Left和Right组件使用什么包?可能这个包和IOS不兼容

你可以试试这个。我只使用原生响应组件

<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>

你也可以添加backgroundColor只是为了看清楚视图。尽量不要依赖于软件包,因为有些软件包并不是在所有的操作系统和expo中都兼容。