我是反应原生的新手,我试图将屏幕分为两个部分,第一部分是标题或导航栏希望有一个大约 40px 的特定高度,第二部分是应用程序的主体或内容希望他的高度必须是手机屏幕上的可用高度,我尝试使用弹性框方法,但它不起作用!这是我的代码:
<View style={styles.mainContainer}>
<View style={styles.navBar}>
</View>
<View style={styles.body}>
</View>
</View>
Run Code Online (Sandbox Code Playgroud)
风格:
mainContainer: {
height: '100%',
display: 'flex',
flexDirection: 'column',
},
navBar: {
display: 'flex',
flexDirection: 'row-reverse',
justifyContent: 'space-between',
alignItems: 'center',
backgroundColor: '#f1f1f1',
height: 30,
},
body: {
flex: 3,
display: 'flex',
},
Run Code Online (Sandbox Code Playgroud)