Browse Source

fix(android): updating source.html prop doesn't refresh webview (#485)

Scott Beca 5 years ago
parent
commit
9aa14f1a96

+ 2
- 6
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java View File

@@ -373,12 +373,8 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
373 373
     if (source != null) {
374 374
       if (source.hasKey("html")) {
375 375
         String html = source.getString("html");
376
-        if (source.hasKey("baseUrl")) {
377
-          view.loadDataWithBaseURL(
378
-            source.getString("baseUrl"), html, HTML_MIME_TYPE, HTML_ENCODING, null);
379
-        } else {
380
-          view.loadData(html, HTML_MIME_TYPE + "; charset=" + HTML_ENCODING, null);
381
-        }
376
+        String baseUrl = source.hasKey("baseUrl") ? source.getString("baseUrl") : "";
377
+        view.loadDataWithBaseURL(baseUrl, html, HTML_MIME_TYPE, HTML_ENCODING, null);
382 378
         return;
383 379
       }
384 380
       if (source.hasKey("uri")) {