|
@@ -6,8 +6,6 @@
|
6
|
6
|
#include "ReactWebView.h"
|
7
|
7
|
#include "ReactWebView.g.cpp"
|
8
|
8
|
|
9
|
|
-#include "winrt/WebViewBridge.h"
|
10
|
|
-
|
11
|
9
|
|
12
|
10
|
|
13
|
11
|
namespace winrt {
|
|
@@ -89,21 +87,19 @@ namespace winrt::ReactNativeWebView::implementation {
|
89
|
87
|
|
90
|
88
|
if (m_messagingEnabled) {
|
91
|
89
|
auto tag = this->GetValue(winrt::FrameworkElement::TagProperty()).as<winrt::IPropertyValue>().GetInt64();
|
92
|
|
-
|
93
|
|
- auto bridge = WebViewBridge::WebBridge(tag);
|
94
|
|
- bridge.MessagePostedEvent(winrt::auto_revoke, [ref = get_weak()](const int32_t& message) {
|
|
90
|
+ m_webBridge = WebViewBridge::WebBridge(tag);
|
|
91
|
+ m_webBridge.MessagePostedEvent(winrt::auto_revoke, [ref = get_weak()](const int32_t& message) {
|
95
|
92
|
if (auto self = ref.get()) {
|
96
|
93
|
self->OnMessagePosted(message);
|
97
|
94
|
}
|
98
|
95
|
});
|
99
|
|
-
|
100
|
|
- webView.AddWebAllowedObject(L"__RN_WEBVIEW_JS_BRIDGE", bridge);
|
|
96
|
+ webView.AddWebAllowedObject(L"__RN_WEBVIEW_JS_BRIDGE", m_webBridge);
|
101
|
97
|
}
|
102
|
98
|
}
|
103
|
99
|
|
104
|
100
|
void ReactWebView::OnMessagePosted(const int32_t& message)
|
105
|
101
|
{
|
106
|
|
-
|
|
102
|
+ // TODO: send to RN
|
107
|
103
|
}
|
108
|
104
|
|
109
|
105
|
void ReactWebView::OnNavigationCompleted(winrt::WebView const& webView, winrt::WebViewNavigationCompletedEventArgs const& /*args*/) {
|