【发布时间】:2017-11-14 21:02:53
【问题描述】:
我是 react-native 的新手,我正在尝试将屏幕划分为两个部分,第一部分是标题或导航栏希望具有大约 40px 的特定高度第二部分是正文或内容该应用程序希望他的高度必须是手机屏幕上的可用高度,我尝试使用弹性框方法但它不起作用! 这是我的代码:
<View style={styles.mainContainer}>
<View style={styles.navBar}>
</View>
<View style={styles.body}>
</View>
</View>
风格:
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',
},
【问题讨论】:
-
将
height: '100%'更改为height: '100vh'...或添加规则html, body { height: 100%; }
标签: react-native flexbox