Browse Source

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

jimerino 5 years ago
parent
commit
9c9b7d721a
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      ios/RNCWKWebView.m

+ 7
- 1
ios/RNCWKWebView.m View 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