@exodus/react-native-webview 11.26.1-exodus.3 → 11.26.1-exodus.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -699,17 +699,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
699
699
  RNCWebView reactWebView = (RNCWebView) root;
700
700
  JSONObject eventInitDict = new JSONObject();
701
701
  eventInitDict.put("data", args.getString(0));
702
- reactWebView.evaluateJavascriptWithFallback("(function () {" +
703
- "var event;" +
704
- "var data = " + eventInitDict.toString() + ";" +
705
- "try {" +
706
- "event = new MessageEvent('message', data);" +
707
- "} catch (e) {" +
708
- "event = document.createEvent('MessageEvent');" +
709
- "event.initMessageEvent('message', true, true, data.data, data.origin, data.lastEventId, data.source);" +
710
- "}" +
711
- "document.dispatchEvent(event);" +
712
- "})();");
702
+ reactWebView.evaluateJavascriptWithFallback("document.dispatchEvent(new MessageEvent('message', " + eventInitDict.toString() + "));");
713
703
  } catch (JSONException e) {
714
704
  throw new RuntimeException(e);
715
705
  }
@@ -872,7 +872,7 @@ RCTAutoInsetsProtocol>
872
872
  {
873
873
  NSDictionary *eventInitDict = @{@"data": message};
874
874
  NSString *source = [NSString
875
- stringWithFormat:@"window.dispatchEvent(new MessageEvent('message', %@));",
875
+ stringWithFormat:@"document.dispatchEvent(new MessageEvent('message', %@));",
876
876
  RCTJSONStringify(eventInitDict, NULL)
877
877
  ];
878
878
  [self injectJavaScript: source];
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "Thibault Malbranche <malbranche.thibault@gmail.com>"
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "11.26.1-exodus.3",
12
+ "version": "11.26.1-exodus.4",
13
13
  "homepage": "https://github.com/ExodusMovement/react-native-webview#readme",
14
14
  "scripts": {
15
15
  "android": "react-native run-android",