Sfoglia il codice sorgente

fix(iOS WKWebView): fixed local html files loading on real devices (#403)

jimerino 5 anni fa
parent
commit
9c9b7d721a
1 ha cambiato i file con 7 aggiunte e 1 eliminazioni
  1. 7
    1
      ios/RNCWKWebView.m

+ 7
- 1
ios/RNCWKWebView.m Vedi File

@@ -294,7 +294,13 @@ static NSURLCredential* clientAuthenticationCredential;
294 294
     [_webView loadHTMLString:@"" baseURL:nil];
295 295
     return;
296 296
   }
297
-  [_webView loadRequest:request];
297
+  if (request.URL.host) {
298
+    [_webView loadRequest:request];
299
+  }
300
+  else {
301
+    [_webView loadFileURL:request.URL allowingReadAccessToURL:request.URL];
302
+  }
303
+
298 304
 }
299 305
 
300 306
 -(void)setHideKeyboardAccessoryView:(BOOL)hideKeyboardAccessoryView