|
@@ -397,6 +397,16 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
397
|
397
|
((RNCWebView) view).setInjectedJavaScriptBeforeContentLoaded(injectedJavaScriptBeforeContentLoaded);
|
398
|
398
|
}
|
399
|
399
|
|
|
400
|
+ @ReactProp(name = "injectedJavaScriptForMainFrameOnly")
|
|
401
|
+ public void setInjectedJavaScriptForMainFrameOnly(WebView view, boolean enabled) {
|
|
402
|
+ ((RNCWebView) view).setInjectedJavaScriptForMainFrameOnly(enabled);
|
|
403
|
+ }
|
|
404
|
+
|
|
405
|
+ @ReactProp(name = "injectedJavaScriptBeforeContentLoadedForMainFrameOnly")
|
|
406
|
+ public void setInjectedJavaScriptBeforeContentLoadedForMainFrameOnly(WebView view, boolean enabled) {
|
|
407
|
+ ((RNCWebView) view).setInjectedJavaScriptBeforeContentLoadedForMainFrameOnly(enabled);
|
|
408
|
+ }
|
|
409
|
+
|
400
|
410
|
@ReactProp(name = "messagingEnabled")
|
401
|
411
|
public void setMessagingEnabled(WebView view, boolean enabled) {
|
402
|
412
|
((RNCWebView) view).setMessagingEnabled(enabled);
|
|
@@ -981,6 +991,14 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
981
|
991
|
String injectedJS;
|
982
|
992
|
protected @Nullable
|
983
|
993
|
String injectedJSBeforeContentLoaded;
|
|
994
|
+
|
|
995
|
+ /**
|
|
996
|
+ * android.webkit.WebChromeClient fundamentally does not support JS injection into frames other
|
|
997
|
+ * than the main frame, so these two properties are mostly here just for parity with iOS & macOS.
|
|
998
|
+ */
|
|
999
|
+ protected boolean injectedJavaScriptForMainFrameOnly = true;
|
|
1000
|
+ protected boolean injectedJavaScriptBeforeContentLoadedForMainFrameOnly = true;
|
|
1001
|
+
|
984
|
1002
|
protected boolean messagingEnabled = false;
|
985
|
1003
|
protected @Nullable
|
986
|
1004
|
RNCWebViewClient mRNCWebViewClient;
|
|
@@ -1058,6 +1076,14 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
1058
|
1076
|
injectedJSBeforeContentLoaded = js;
|
1059
|
1077
|
}
|
1060
|
1078
|
|
|
1079
|
+ public void setInjectedJavaScriptForMainFrameOnly(boolean enabled) {
|
|
1080
|
+ injectedJavaScriptForMainFrameOnly = enabled;
|
|
1081
|
+ }
|
|
1082
|
+
|
|
1083
|
+ public void setInjectedJavaScriptBeforeContentLoadedForMainFrameOnly(boolean enabled) {
|
|
1084
|
+ injectedJavaScriptBeforeContentLoadedForMainFrameOnly = enabled;
|
|
1085
|
+ }
|
|
1086
|
+
|
1061
|
1087
|
protected RNCWebViewBridge createRNCWebViewBridge(RNCWebView webView) {
|
1062
|
1088
|
return new RNCWebViewBridge(webView);
|
1063
|
1089
|
}
|