React Native' WebView'不在生产构建中加载脚本-IOS

发布于 2025-01-22 09:45:11 字数 1661 浏览 4 评论 0原文

我的html文件带有脚本,我需要在react react屏幕中显示它,因此我使用了react-native-native-webview,它在ios debug构建但在ios生产构建中不起作用,

这是我的html页面,

<html >
  <meta name="viewport" content="width=device-width, initial-scale=1" />
<body onload="loader();">

<script>
    window.fwSettings = {
        'widget_id': 7300********
    };
    !function () { 
        if ("function" != typeof window.FreshworksWidget)
         { 
             var n = function () {
                  n.q.push(arguments) 
                }; 
                n.q = [],
                 window.FreshworksWidget = n } }() 
</script>
<script type='text/javascript' 
   src='https://widget.freshworks.com/widgets/7*********.js' async defer></script>

<script>
    function loader() {
        FreshworksWidget('hide', 'launcher');
        FreshworksWidget('open');
    };
 </script>
</body>

</html>

我将此HTML页面放置在webview

<WebView
      source={kbHTML}
      javaScriptEnabled={true}
      domStorageEnabled={true}
      originWhitelist={['*']}
      scalesPageToFit={false}
      startInLoadingState={true}
      automaticallyAdjustContentInsets={false}
      containerStyle={{
        flex: 1,
        width: '100%',
        height: '100%'
      }}
    
      style={{
        flex: 1,
        height: height,
        width: width,
        resizeMode: 'cover',
      }}

    />

之类调试模式,但在ios生产构建中不起作用。

react-native-webview:“^11.18.1”, 反应:“ 0.64.2”

I have html file with scripts, I need to display it in React native screen so I used react-native-webview, it is working fine in ios debug build but not working in ios production build getting blank screen

This is my html page

<html >
  <meta name="viewport" content="width=device-width, initial-scale=1" />
<body onload="loader();">

<script>
    window.fwSettings = {
        'widget_id': 7300********
    };
    !function () { 
        if ("function" != typeof window.FreshworksWidget)
         { 
             var n = function () {
                  n.q.push(arguments) 
                }; 
                n.q = [],
                 window.FreshworksWidget = n } }() 
</script>
<script type='text/javascript' 
   src='https://widget.freshworks.com/widgets/7*********.js' async defer></script>

<script>
    function loader() {
        FreshworksWidget('hide', 'launcher');
        FreshworksWidget('open');
    };
 </script>
</body>

</html>

I placed this html page in Webview like this

<WebView
      source={kbHTML}
      javaScriptEnabled={true}
      domStorageEnabled={true}
      originWhitelist={['*']}
      scalesPageToFit={false}
      startInLoadingState={true}
      automaticallyAdjustContentInsets={false}
      containerStyle={{
        flex: 1,
        width: '100%',
        height: '100%'
      }}
    
      style={{
        flex: 1,
        height: height,
        width: width,
        resizeMode: 'cover',
      }}

    />

its working fine in ios debug mode but not working in ios production build.getting blank screen.

react-native-webview: "^11.18.1",
react-native: "0.64.2"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文