Browse Source

injectedJavaScriptBeforeContentLoaded should run even if messaging is not enabled

Salvatore Randazzo 4 years ago
parent
commit
4cbb8cf7dc
1 changed files with 6 additions and 6 deletions
  1. 6
    6
      ios/RNCWebView.m

+ 6
- 6
ios/RNCWebView.m View File

@@ -200,12 +200,12 @@ static NSDictionary* customCertificatesForHost;
200 200
 
201 201
     WKUserScript *script = [[WKUserScript alloc] initWithSource:source injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:YES];
202 202
     [wkWebViewConfig.userContentController addUserScript:script];
203
-      
204
-    if (_injectedJavaScriptBeforeContentLoaded) {
205
-      // If user has provided an injectedJavascript prop, execute it at the start of the document
206
-      WKUserScript *injectedScript = [[WKUserScript alloc] initWithSource:_injectedJavaScriptBeforeContentLoaded injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:YES];
207
-      [wkWebViewConfig.userContentController addUserScript:injectedScript];
208
-    }
203
+  }
204
+
205
+  if (_injectedJavaScriptBeforeContentLoaded) {
206
+    // If user has provided an injectedJavascript prop, execute it at the start of the document
207
+    WKUserScript *injectedScript = [[WKUserScript alloc] initWithSource:_injectedJavaScriptBeforeContentLoaded injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:YES];
208
+    [wkWebViewConfig.userContentController addUserScript:injectedScript];
209 209
   }
210 210
 
211 211
   wkWebViewConfig.allowsInlineMediaPlayback = _allowsInlineMediaPlayback;