我有这个代码
render() {
return (
<View style={styles.container}>
<TopMenu />
<ScrollView style={styles.scrollView}>
{array_with_two_items.map(this.createRow)}
</ScrollView>
</View>
)
}
Run Code Online (Sandbox Code Playgroud)
与风格
scrollView: {
flex:1,
marginBottom:0,
},
containter: {
flex:1,
},
Run Code Online (Sandbox Code Playgroud)
问题是它看起来像这样
+-----------+
| MENU |
+-----------+
| item1 |
+-----------+
| item2 |
+-----------+
| |
| blank |
| not |
| scrollable|
+-----------+
Run Code Online (Sandbox Code Playgroud)
但我希望它看起来像
+-----------+
| MENU |
+-----------+
| item1 |
+-----------+
| item2 |
+-----------+
| blank,but |
| still |
| part of |
| scrollview|
+-----------+
Run Code Online (Sandbox Code Playgroud)
我对样式和flexbox的经验很少,所以这就是我要问的原因。(菜单不应该是滚动视图的一部分)
Tyl*_*ler 11
我想你想要的是flexGrow- flexGrow 文档
<ScrollView style={{ flex: 1 }} contentContainerStyle={{ flexGrow: 1 }}>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
只需将道具contentContainerStyle给 ScrollView ,如:
<ScrollView
contentContainerStyle={{
flex: 1
}}
>
/* Other Stuff */
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4050 次 |
| 最近记录: |