Android 如何通过下拉刷新Expo Webview中的页面?
我用Expo制作了Webview应用程序,观看youtube 起初,我制作了这样的基本应用程序Android 如何通过下拉刷新Expo Webview中的页面?,android,reactjs,android-webview,refresh,native,Android,Reactjs,Android Webview,Refresh,Native,我用Expo制作了Webview应用程序,观看youtube 起初,我制作了这样的基本应用程序 import * as React from 'react'; import { WebView } from 'react-native-webview'; export default class App extends React.Component { render() { return <WebView source={{ uri: 'https://www.g
import * as React from 'react';
import { WebView } from 'react-native-webview';
export default class App extends React.Component {
render() {
return <WebView
source={{ uri: 'https://www.google.com' }}
allowsFullscreenVideo={true}
allowsBackForwardNavigationGestures={true}
style={{ marginTop: 20 }} />;
}
}
- 结论:我需要这些功能
您可以将样式添加到滚动和网络视图
container: {
position : 'relative',
},
ScrollStyle :{
backgroundColor : 'white',
position: 'relative',
}
<View style={{flex: 1}}>
<ScrollView
style = {styles.ScrollStyle}
contentContainerStyle={{flex: 1}}
refreshControl={
<RefreshControl
refreshing={false}
onRefresh={this.yourFunctionReload} // exl in function : this.yourWebview.reload();
/>
}
>
<Header />
<WebView
stylestyle={styles.container}
.....
/>
</ScrollView>
然后渲染ScrollView和Webview
container: {
position : 'relative',
},
ScrollStyle :{
backgroundColor : 'white',
position: 'relative',
}
<View style={{flex: 1}}>
<ScrollView
style = {styles.ScrollStyle}
contentContainerStyle={{flex: 1}}
refreshControl={
<RefreshControl
refreshing={false}
onRefresh={this.yourFunctionReload} // exl in function : this.yourWebview.reload();
/>
}
>
<Header />
<WebView
stylestyle={styles.container}
.....
/>
</ScrollView>
注意:不要忘记导入视图、滚动视图、刷新控制和网络视图非常感谢!我将应用你的答案。:)
<View style={{flex: 1}}>
<ScrollView
style = {styles.ScrollStyle}
contentContainerStyle={{flex: 1}}
refreshControl={
<RefreshControl
refreshing={false}
onRefresh={this.yourFunctionReload} // exl in function : this.yourWebview.reload();
/>
}
>
<Header />
<WebView
stylestyle={styles.container}
.....
/>
</ScrollView>