簡體   English   中英

React Native Google Captcha 在 webview 中顯示白色空白屏幕

[英]React Native Google Captcha showing white blank screen in webview

我正在嘗試使用 webview 在 React Native 中實現谷歌驗證碼,但它在應用程序加載時顯示白屏。 我試過但無法解決這個問題,請問有人能幫我解決這個問題嗎?

謝謝

 <WebView
  automaticallyAdjustContentInsets={false}
  source={{
    html: `
       <div
        <script src="https://www.google.com/recaptcha/api.js?render=6Lel4Z4UAAAAAOa8LO1Q9mqKRUiMYl_00o5mXJrR" async defer ></script>

        <div class="g-recaptcha" data-sitekey="6Lel4Z4UAAAAAOa8LO1Q9mqKRUiMYl_00o5mXJrR"></div>
                   `,
  }}
  style={{ marginTop: 30, height: 130, width: Dimensions.get("window").width }}
/>;

Webview 只是顯示來自 URL 的內容。

當我將您的鏈接粘貼到瀏覽器中時。 我收到以下錯誤。 嘗試使用另一個 URL。查看我的代碼以獲取更多參考。

Bad Request
Error 400

這就是您的Webview出現白色空白屏幕的原因。

import React, { Component } from 'react';
import { WebView } from 'react-native-webview';

class MyWebComponent extends Component {
  render() {
    return <WebView source={{ uri: 'https://reactnative.dev/' }} />;
  }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM