react-native - ScrollView 不适用于 SimpleAccordian 视图/
问题描述
我正在尝试使用组件创建一个 Accordian:来自 library:'react-native-simple-accordian'。但是当手风琴标题的数量更多时,我看不到 ScrollView 正常工作。
我的代码:
<View style={{flex:1}}>
<ScrollView style={{flex:1}}>
<View style={styles.container}>
<SimpleAccordion
style= {{
borderWidth:1,
borderRadius:15,
margin:3,
padding:5,
backgroundColor:'#ffffff'
}}
sections={sectionData}
renderHeader= {this.renderHeader}
renderContent={this.renderContent}
duration={1000}
touchableComponent={TouchableOpacity}
onChange={this.onChangeAccordian.bind(this)}
activeSection={this.state.open}
/>
</View>
</ScrollView>
</View>
样式对象是这样的:
container: {
flex: 1,
justifyContent: 'center',
},
我在这里为 ScrollView 做错了什么样式或定位?反应式
解决方案
在 react-native ScrollView 的情况下,您可能需要在“contentContainerStyle”道具中提供样式,并且您可能还需要将 flexGrow 的样式属性设置为 1
contentContainerStyle = {{
flexGrow:1
}}
推荐阅读
- json - 如何使用jq过滤具有混合类型元素的数组
- maven - Is there any automated way to get artifact download URL back from artifactory?
- android - Android:适配器的viewconvert为空,但我通过了正确的布局
- java - 如何使用两个不同长度的数组在表中打印值
- tensorflow - Tensorflow memory consumption is different on VM
- python - Co occurance matrix for tfidf vectorizer for top 2000 words
- java - The HTTP response from the server [200] did not permit the HTTP upgrade to WebSocket
- sql - How to dynamically create and populate a local temp table (when the table headers are unknown)?
- c# - Prevent default pdf reader open after call PrintTo c#
- node.js - 使用 Chrome、webRoot 属性调试 VS Code