【发布时间】:2018-05-28 17:11:10
【问题描述】:
我在 React Native 应用程序的 ScrollView 中有一个 WebView。 ScrollView 具有 refreshControl 属性,因此当我到达应用程序顶部时可以刷新 WebView。
问题是:我滚动 WebView 没有问题,但是每当我向上滑动到页面顶部时,无论我是在页面的末尾、中间还是开头,都没有关系, refreshControl 总是被触发。
当scrollY:0且scrollY一直为0时触发RefreshControl,因为滚动的不是ScrollView而是WebView,所以ScrollView一直在scrollY:0。
我已经在 WebView 和 ScrollView 上尝试了 scrollEnabled 属性,但都没有成功。
下面是代码现在的样子:
<View style={{flex: 1}}>
<ScrollView
contentContainerStyle={{flex: 1}}
refreshControl={
<RefreshControl
refreshing={this.state.refreshing}
onRefresh={this._onRefresh.bind(this)}
/>
}
>
<WebView
ref="webview"
source={{uri: initialUrl}}
/>
</ScrollView>
</View>
我已经删除了所有的道具来尝试重新开始,但我总是遇到同样的问题。在 iOS 上它工作正常,没有这个问题。
是的,我在这个母亲视图中确实有其他东西。
【问题讨论】:
标签: android react-native webview scrollview pull-to-refresh