【问题标题】:react-native-webview scroll not coming in androidreact-native-webview滚动没有进入android
【发布时间】:2020-09-25 14:03:50
【问题描述】:

我正在使用 expo 并在滚动视图中有一个 expo react-native-webview,下面是返回 webview 的组件的返回。 我正在做的是创建屏幕,我想解析我的 html 并在容器中的屏幕上显示。 容器的设计是在调用该组件的父屏幕中进行的。 问题 1:我尝试了多种解决方案来在 android 设备中的 webview 内滚动,但没有任何效果。 下面的代码与 IOS 设备完美配合。

问题 2:我们能否将 webview 限制为仅在视图中显示 5 行并将其余部分转为 (...) ? 有人可以帮忙吗?

  return (
    <View style={{ flex: 1 }}>
      <WebView
        originWhitelist={["*"]}
        source={{ html: htmlContent }}
        style={styles.WebViewStyle}
      />

    </View>

  );

const styles = StyleSheet.create({
  WebViewStyle: {
    flex: 1,
    marginLeft: 5,
    height: 150,
    width: '100%',

  }
});

【问题讨论】:

    标签: android react-native expo react-native-webview


    【解决方案1】:

    最后我需要采取另一种方式进行修复。 当我使用滚动视图时,webview 是子视图,因为它在 IOS 上运行良好,但 android webview 没有滚动。 问题是滚动视图都是 webview 试图获取屏幕高度并被混淆。 所以我把 webview 移出了滚动视图。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-08-15
      • 2017-10-02
      • 2020-12-13
      • 2020-01-23
      • 2022-12-04
      • 2016-09-25
      • 2019-08-13
      • 1970-01-01
      相关资源
      最近更新 更多