ReactWindows / third-party-module-status

A list of third-party React Native modules that should be / have been / are being ported to react-native-windows.
1 stars 0 forks source link

react-native-webview-bridge for react-native-windows #2

Open rozele opened 6 years ago

rozele commented 6 years ago

After the initial investigation, I've found two options for communication from the WebView back to the native bridge, AddWebAllowedObject and window.external.notify.

There are limitations with both of these: 1) WebView.AddWebAllowedObject works only works when navigated from NavigateToString or when navigating to a ms-appx-web: URI, and I have to introduce an additional WinRT component library in order to use it. 2) window.external.notify only works when the URIs are whitelisted in the appxmanifest or from NavigateToString / ms-appx-web: URIs.

Currently, the most flexible is likely the ScriptNotify event and window.external.notify, with the caveat that the app needs to declare upfront what domains are supported (and it must use HTTPS).

rozele commented 6 years ago

I've reached out to the Web Platform team in Windows for further guidance on if we have any options for more general hooks in WebView.

rozele commented 6 years ago

Confirmed with Web Platforms team scenario to load JavaScript prior to page loading is not currently supported in UWP.