ソースを参照

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
                                                                        name:MessageHandlerName];
1245
                                                                        name:MessageHandlerName];
1246
       [wkWebViewConfig.userContentController addUserScript:self.postMessageScript];
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
     if (self.atEndScript) {
1248
     if (self.atEndScript) {
1253
       [wkWebViewConfig.userContentController addUserScript:self.atEndScript];
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
 - (NSURLRequest *)requestForSource:(id)json {
1258
 - (NSURLRequest *)requestForSource:(id)json {