我有在 IOS 上运行的 React Native Refresh 控件。
https://facebook.github.io/react-native/docs/refreshcontrol.html
我在 android sim 上运行它,但它不起作用。
错误提示未处理的 Promise Rejection。
这是文件的修剪版本,因此您可以看到设置:
import React, { Component } from 'react';
import {
RefreshControl,
} from 'react-native';
export default class Products extends Component {
_onRefresh() {
this.setState({refreshing: true});
this.likedProducts()
}
render() {
return (
<View style={styles.container}>
<ScrollView
contentContainerStyle={styles.scrollContent}
showsHorizontalScrollIndicator={false}
showsVerticalScrollIndicator={false}
refreshControl={
<RefreshControl
refreshing={this.state.refreshing}
onRefresh={this._onRefresh.bind(this)}
/>
}
>
...
</ScrollView>
</View>
}
}
}
最佳答案
我不知道是否支持在 Android 上使用带有 RefreshControl 的 ScrollView。我建议使用 https://facebook.github.io/react-native/docs/flatlist.html反而。在那里,您已经在 Android 和 iOS 上原生集成了下拉刷新。
关于android - React Native 刷新控件是否适用于 Android?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47157459/