ソースを参照

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

Scott Beca 5 年 前
コミット
9aa14f1a96
共有1 個のファイルを変更した2 個の追加6 個の削除を含む
  1. 2
    6
      android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java

+ 2
- 6
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java ファイルの表示

@@ -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")) {