Ver código fonte

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

Salvatore Randazzo 4 anos atrás
pai
commit
571fb8df79
Nenhuma conta vinculada ao e-mail do autor do commit
1 arquivos alterados com 4 adições e 4 exclusões
  1. 4
    4
      ios/RNCWebView.m

+ 4
- 4
ios/RNCWebView.m Ver arquivo

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