瀏覽代碼

fix(iOS): injectedJavaScriptBeforeContentLoaded now runs when messaging is not enabled (#1286)

Salvatore Randazzo 4 年之前
父節點
當前提交
571fb8df79
No account linked to committer's email address
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4
    4
      ios/RNCWebView.m

+ 4
- 4
ios/RNCWebView.m 查看文件

@@ -1245,14 +1245,14 @@ static NSDictionary* customCertificatesForHost;
1245 1245
                                                                        name:MessageHandlerName];
1246 1246
       [wkWebViewConfig.userContentController addUserScript:self.postMessageScript];
1247 1247
     }
1248
-    // FIXME: For a separate (minor) PR: these two shouldn't be gated by messagingEnabled; just keeping consistency with previous behaviour.
1249
-    if (self.atStartScript) {
1250
-      [wkWebViewConfig.userContentController addUserScript:self.atStartScript];
1251
-    }
1252 1248
     if (self.atEndScript) {
1253 1249
       [wkWebViewConfig.userContentController addUserScript:self.atEndScript];
1254 1250
     }
1255 1251
   }
1252
+  // Whether or not messaging is enabled, add the startup script if it exists.
1253
+  if (self.atStartScript) {
1254
+    [wkWebViewConfig.userContentController addUserScript:self.atStartScript];
1255
+  }
1256 1256
 }
1257 1257
 
1258 1258
 - (NSURLRequest *)requestForSource:(id)json {