Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others


0 votes
in Technique[技术] by (71.8m points)

React Native WebView is not getting loaded same url request second times

I am using react-native-webview in my project and i facing issue while loading the request second times.

Here is the request object

type WebRequest = {
  uri: string,
  method: string,
  body?: any,
  headers: any

below is the state

const [webRequest, setWebRequest] = useState<WebRequest>();

this is how i implemented web view

        ref={WEBVIEW_REF => (WebViewRef = WEBVIEW_REF)}
        onLoadStart={(e) => {
          console.log("onLoadStart ", e);
        onLoadEnd={(e) => {
          console.log("onLoadEnd ", e);
        onError={(e) => {
     console.log("onLoadEnd ", e);

On click on a button the below code will be executed and will be loaded url request.

const webViewRequest: WebRequest = {
      uri: "http://example.com/page”,
      method: 'GET',
      headers: {
        “header1: “aaaaa”,
        "header2”: “xxx”

It is working fine if i click on a button and load the above request but second time webview is not getting loaded.

Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share