android - 如何使 WebView 在 react-native-webview 中可滚动?

标签 android ios react-native react-native-webview react-native-paper

我有<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/

相关文章:

java - 如何将多个单选按钮分组到单选组下

ios - 如何在另一个脚本中调用 `pod` 或 'target'

react-native - 从我们离开的地方开始视频

java - 我手动强制退出应用程序并重新启动后,异步任务不会调用 OnPostExecute 或 onProgressUpdate

android - 无法在 FrameLayout 上滚动 2 个 ScrollView

iphone - iOS访问字符串中的字符

html - 垂直对齐按钮文本?

react-native - `react-native init AwesomeProject` 抛出语法错误

javascript - 使用 React Native 异步返回一个值

android - 从 NavController 获取 fragment