我有<WebView>
嵌入在 <Card.Content>
中因为我正在使用 react-native-paper
.我正在尝试 WebView
可滚动。 WebView 显示但不可滚动。
我正在使用的代码:
<Card theme={{ roundness: 20 }} style={{ margin: 10, height: height*0.8 }} elevation={14}>
<Card.Content style={{ flex: 1 }}>
<View style={{ justifyContent: "center", alignItems: "center" }}>
<WebView
style={{ width: width * 0.8, height: height * 0.9 }}
allowsBackForwardNavigationGestures={false}
source={{ uri: "https://paypal.com"}}
pullToRefreshEnabled={false}
javaScriptEnabled
startInLoadingState
decelerationRate="normal"
scalesPageToFit={Platform.OS == "android"? false : true}
originWhitelist={['*']}
domStorageEnabled={true}
scrollEnabled
renderError={e => { console.log(e); }}
/>
</View>
</Card.Content>
</Card>
我怎样才能制作WebView
可滚动?
最佳答案
只需在 webview 组件中添加 nestedScrollEnabled=true
属性
<ScrollView
<WebView nestedScrollEnabled source={{uri:'https://www.website.com' }} />
</ScrollView>
关于android - 如何使 WebView 在 react-native-webview 中可滚动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63568982/