【发布时间】:2017-11-26 22:14:09
【问题描述】:
如何将 ScrollView 设置为“占用所有剩余空间”而不是设置 height: XXXX ?
<ScrollView >
<View style={{
flex: 1,
flexDirection: 'column',
justifyContent: 'space-between',
}}>
<View style={{width: 50, height: 50, backgroundColor: 'powderblue'}} />
<View style={{width: 50, height: 50, backgroundColor: 'skyblue'}} />
<View style={{width: 50, height: 50, backgroundColor: 'steelblue'}} />
</View>
</ScrollView>
【问题讨论】:
-
@JigarShah 我不想使用任何外部库
-
使用
ScrollView可能无法实现。您需要为所有元素提供height以覆盖完整的height。您可以使用屏幕高度动态分配height。这适用于所有屏幕。
标签: android ios react-native flexbox