我的 React 项目中有一个滚动视图,应该列出一个数据映射。 这些磁贴还会打开折叠样式以显示更多信息。九个项目应该被映射和查看,但是滚动视图只显示7个,最后一个被切断/手风琴和瓷砖本身。
尝试:使用 flex创建视图:1,使用 FlexGrow 而不是 flex,添加高度:100。
<ScrollView style={styles.contentContainer}>
<View style={styles.accordianContainer}>
<Accordion
sections={this.props.gyms}
activeSections={this.state.activeSections}
renderHeader={this._renderHeader}
renderContent={this._renderContent}
onChange={this._updateSections}
underlayColor={"#ffffff"}
/>
</View>
</ScrollView>
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
},
contentContainer: {
flex: 1,
borderColor: 'red',
borderWidth: 1,
},
accordianContainer: {
height: ( Layout.noStatusBarHeight)* .9,
width: Layout.window.width,
marginBottom: Layout.window.height / 4,
}
我遇到了类似的问题,通过在滚动视图底部添加一个具有一定高度的额外视图,我找到了解决方案:
<View style={{height: 54}} />
希望对您有所帮助。