首页 > 解决方案 > 加载 html / 脚本时 React Native Webview 不起作用

问题描述

我正在尝试使用“react-native-webview”库加载一个小部件。我相信我这样做是正确的,但小部件没有加载,我试图在 webview 本身上设置断点,它看起来像它的构建,有什么建议吗?

<WebView
          source={{
            html: `<!DOCTYPE html>
            <html>

              <body>
              <script src="https://widgets.coingecko.com/coingecko-coin-price-marquee-widget.js"></script>
              <coingecko-coin-price-marquee-widget  coin-ids="bitcoin,ethereum,eos,ripple,litecoin" currency="usd" background-color="#ffffff" locale="en">
              </coingecko-coin-price-marquee-widget>
              </body>
            </html>`,
          }}
        />

标签: javascripthtmlreact-native

解决方案


解决方案 - 我需要给 react-native-webview 一个宽度。


推荐阅读