问题描述
我正在尝试使用以下组件创建Accordian:来自库:“ 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做错了什么样式或位置? 反应本机
解决方法
在使用本机ScrollView的情况下,您可能需要在“ contentContainerStyle”道具中指定样式,并且可能还需要将flexGrow的样式属性设置为1
dataSource = new MatTableDataSource < OrdersDetailsDataSource > (null);
ngOnInit() {
this.getAllOrders()
}
getAllOrders() {
this.apiService.getOrders().subscribe((data: any) => {
this.dataSource = new MatTableDataSource < OrdersDetailsDataSource > (data); //pass the array you want in the table
this.dataSource.sort = this.sort;
this.dataSource.paginator = this.paginator;
return data
})