New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Windows] JS-WebView messaging bridge & multiple WebViews fixes #1617
Merged
Titozzz
merged 32 commits into
react-native-webview:master
from
showell-labs:add-web-allowed-object-cpp-winrt
Oct 26, 2020
Merged
[Windows] JS-WebView messaging bridge & multiple WebViews fixes #1617
Titozzz
merged 32 commits into
react-native-webview:master
from
showell-labs:add-web-allowed-object-cpp-winrt
Oct 26, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tero-paananen
requested review from
jamonholmgren and
Titozzz
as code owners
September 7, 2020 08:12
Titozzz
approved these changes
Oct 26, 2020
react-native-community-bot
pushed a commit
that referenced
this pull request
Oct 26, 2020
# [10.10.0](v10.9.3...v10.10.0) (2020-10-26) ### Features * **windows:** JS-WebView messaging bridge & multiple WebViews fixes ([#1617](#1617)) ([b930e25](b930e25))
🎉 This PR is included in version 10.10.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
nice work. Is it possible to have one document within a WKWebview, which then calls a |
This was referenced Feb 1, 2021
This was referenced Mar 9, 2021
Merged
Merged
Merged
Merged
This was referenced Mar 17, 2021
Merged
noproblem23
added a commit
to noproblem23/react-native-webview
that referenced
this pull request
Apr 18, 2023
# [10.10.0](react-native-webview/react-native-webview@v10.9.3...v10.10.0) (2020-10-26) ### Features * **windows:** JS-WebView messaging bridge & multiple WebViews fixes ([#1617](react-native-webview/react-native-webview#1617)) ([b930e25](react-native-webview/react-native-webview@b930e25))
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR contains also important changes from my other PR about support of multiple webviews in same time in the app #1603
Adds JS-WebView messaging bridge C++/WinRT component that overwrites old postMessage messaging api
window.ReactNativeWebView = {postMessage: function (data) {window.external.notify(String(data))}};
Now messaging works in any kind of source of webview html. Messaging is handled via
WebView.AddWebAllowedObject
WinRT component "bridge". Same kind of bridge implementation exists in old legacy C# implementation of webview in react-native 0.59. See ReactWebViewManager.cs and line 390Bridge is enabled after developer defines
WebView.onMessage
handler.Bridge is implemented into new
Windows Runtime Component (C++/WinRT)
component namedWebViewBridgeComponent
This PR closes issuess #1600 and #1572
Test Plan
Module and bridge component tested in C# and C++ application.
You can test postMessaging using modules examples app. Message from JS is received in native side by new bridge:
Setup
ReactNativeWebView
andWebViewBridgeComponent
have to added into your solution.sln
file, for example:Add project reference to
ReactNativeWebView
into your project file, for example.csproj
file:Compatibility
Windows
React Native Windows 0.62.x
Checklist