Explorar el Código

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

jimerino hace 5 años
padre
commit
9c9b7d721a
Se han modificado 1 ficheros con 7 adiciones y 1 borrados
  1. 7
    1
      ios/RNCWKWebView.m

+ 7
- 1
ios/RNCWKWebView.m Ver fichero

@@ -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