@javascriptcommon/react-native-webview 13.12.16

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.
Files changed (120) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +82 -0
  3. package/android/build.gradle +110 -0
  4. package/android/gradle.properties +5 -0
  5. package/android/src/main/AndroidManifest.xml +15 -0
  6. package/android/src/main/AndroidManifestNew.xml +13 -0
  7. package/android/src/main/java/com/reactnativecommunity/webview/RNCBasicAuthCredential.java +11 -0
  8. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebChromeClient.java +372 -0
  9. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebView.java +450 -0
  10. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewClient.java +328 -0
  11. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewConfig.java +11 -0
  12. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewFileProvider.java +14 -0
  13. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManagerImpl.kt +720 -0
  14. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewMessagingModule.kt +19 -0
  15. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewModuleImpl.java +554 -0
  16. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewPackage.java +56 -0
  17. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewWrapper.kt +39 -0
  18. package/android/src/main/java/com/reactnativecommunity/webview/URLUtil.java +179 -0
  19. package/android/src/main/java/com/reactnativecommunity/webview/events/TopCustomMenuSelectionEvent.kt +24 -0
  20. package/android/src/main/java/com/reactnativecommunity/webview/events/TopHttpErrorEvent.kt +25 -0
  21. package/android/src/main/java/com/reactnativecommunity/webview/events/TopLoadingErrorEvent.kt +25 -0
  22. package/android/src/main/java/com/reactnativecommunity/webview/events/TopLoadingFinishEvent.kt +24 -0
  23. package/android/src/main/java/com/reactnativecommunity/webview/events/TopLoadingProgressEvent.kt +24 -0
  24. package/android/src/main/java/com/reactnativecommunity/webview/events/TopLoadingStartEvent.kt +25 -0
  25. package/android/src/main/java/com/reactnativecommunity/webview/events/TopMessageEvent.kt +24 -0
  26. package/android/src/main/java/com/reactnativecommunity/webview/events/TopNewWindowEvent.kt +25 -0
  27. package/android/src/main/java/com/reactnativecommunity/webview/events/TopRenderProcessGoneEvent.kt +26 -0
  28. package/android/src/main/java/com/reactnativecommunity/webview/events/TopShouldStartLoadWithRequestEvent.kt +29 -0
  29. package/android/src/main/res/xml/file_provider_paths.xml +6 -0
  30. package/android/src/newarch/com/reactnativecommunity/webview/RNCWebViewManager.java +553 -0
  31. package/android/src/newarch/com/reactnativecommunity/webview/RNCWebViewModule.java +63 -0
  32. package/android/src/oldarch/com/reactnativecommunity/webview/RNCWebViewManager.java +328 -0
  33. package/android/src/oldarch/com/reactnativecommunity/webview/RNCWebViewModule.java +59 -0
  34. package/apple/RCTConvert+WKDataDetectorTypes.h +11 -0
  35. package/apple/RCTConvert+WKDataDetectorTypes.m +27 -0
  36. package/apple/RNCWKProcessPoolManager.h +15 -0
  37. package/apple/RNCWKProcessPoolManager.m +36 -0
  38. package/apple/RNCWebView.h +35 -0
  39. package/apple/RNCWebView.mm +546 -0
  40. package/apple/RNCWebViewDecisionManager.h +20 -0
  41. package/apple/RNCWebViewDecisionManager.m +47 -0
  42. package/apple/RNCWebViewImpl.h +161 -0
  43. package/apple/RNCWebViewImpl.m +1979 -0
  44. package/apple/RNCWebViewManager.h +9 -0
  45. package/apple/RNCWebViewManager.mm +215 -0
  46. package/apple/RNCWebViewModule.h +23 -0
  47. package/apple/RNCWebViewModule.mm +34 -0
  48. package/index.d.ts +65 -0
  49. package/index.js +4 -0
  50. package/ios/RNCWebView.xcodeproj/project.pbxproj +273 -0
  51. package/lib/NativeRNCWebViewModule.d.ts +10 -0
  52. package/lib/NativeRNCWebViewModule.js +1 -0
  53. package/lib/RNCWebViewNativeComponent.d.ts +242 -0
  54. package/lib/RNCWebViewNativeComponent.js +1 -0
  55. package/lib/WebView.android.d.ts +6 -0
  56. package/lib/WebView.android.js +1 -0
  57. package/lib/WebView.d.ts +6 -0
  58. package/lib/WebView.ios.d.ts +6 -0
  59. package/lib/WebView.ios.js +1 -0
  60. package/lib/WebView.js +1 -0
  61. package/lib/WebView.macos.d.ts +6 -0
  62. package/lib/WebView.macos.js +1 -0
  63. package/lib/WebView.styles.d.ts +38 -0
  64. package/lib/WebView.styles.js +1 -0
  65. package/lib/WebView.windows.d.ts +17 -0
  66. package/lib/WebView.windows.js +1 -0
  67. package/lib/WebViewNativeComponent.macos.d.ts +3 -0
  68. package/lib/WebViewNativeComponent.macos.js +1 -0
  69. package/lib/WebViewNativeComponent.windows.d.ts +3 -0
  70. package/lib/WebViewNativeComponent.windows.js +1 -0
  71. package/lib/WebViewShared.d.ts +38 -0
  72. package/lib/WebViewShared.js +1 -0
  73. package/lib/WebViewTypes.d.ts +1093 -0
  74. package/lib/WebViewTypes.js +1 -0
  75. package/lib/index.d.ts +3 -0
  76. package/lib/index.js +1 -0
  77. package/macos/RNCWebView.xcodeproj/project.pbxproj +363 -0
  78. package/package.json +101 -0
  79. package/react-native-webview.podspec +46 -0
  80. package/react-native.config.js +44 -0
  81. package/src/NativeRNCWebViewModule.ts +15 -0
  82. package/src/RNCWebViewNativeComponent.ts +342 -0
  83. package/src/WebView.android.tsx +317 -0
  84. package/src/WebView.ios.tsx +299 -0
  85. package/src/WebView.macos.tsx +245 -0
  86. package/src/WebView.styles.ts +41 -0
  87. package/src/WebView.tsx +25 -0
  88. package/src/WebView.windows.tsx +210 -0
  89. package/src/WebViewNativeComponent.macos.ts +7 -0
  90. package/src/WebViewNativeComponent.windows.ts +8 -0
  91. package/src/WebViewShared.tsx +283 -0
  92. package/src/WebViewTypes.ts +1332 -0
  93. package/src/__tests__/WebViewShared-test.js +323 -0
  94. package/src/__tests__/__snapshots__/WebViewShared-test.js.snap +8 -0
  95. package/src/index.ts +4 -0
  96. package/windows/ExperimentalFeatures.props +11 -0
  97. package/windows/ReactNativeWebView/PropertySheet.props +16 -0
  98. package/windows/ReactNativeWebView/ReactNativeWebView.def +3 -0
  99. package/windows/ReactNativeWebView/ReactNativeWebView.filters +33 -0
  100. package/windows/ReactNativeWebView/ReactNativeWebView.vcxproj +189 -0
  101. package/windows/ReactNativeWebView/ReactPackageProvider.cpp +26 -0
  102. package/windows/ReactNativeWebView/ReactPackageProvider.h +20 -0
  103. package/windows/ReactNativeWebView/ReactPackageProvider.idl +7 -0
  104. package/windows/ReactNativeWebView/ReactWebView.cpp +242 -0
  105. package/windows/ReactNativeWebView/ReactWebView.h +56 -0
  106. package/windows/ReactNativeWebView/ReactWebView.idl +31 -0
  107. package/windows/ReactNativeWebView/ReactWebView2.cpp +473 -0
  108. package/windows/ReactNativeWebView/ReactWebView2.h +91 -0
  109. package/windows/ReactNativeWebView/ReactWebView2Manager.cpp +205 -0
  110. package/windows/ReactNativeWebView/ReactWebView2Manager.h +57 -0
  111. package/windows/ReactNativeWebView/ReactWebViewHelpers.cpp +70 -0
  112. package/windows/ReactNativeWebView/ReactWebViewHelpers.h +16 -0
  113. package/windows/ReactNativeWebView/ReactWebViewManager.cpp +224 -0
  114. package/windows/ReactNativeWebView/ReactWebViewManager.h +58 -0
  115. package/windows/ReactNativeWebView/WebBridge.cpp +19 -0
  116. package/windows/ReactNativeWebView/WebBridge.h +24 -0
  117. package/windows/ReactNativeWebView/WebBridge.idl +11 -0
  118. package/windows/ReactNativeWebView/pch.cpp +1 -0
  119. package/windows/ReactNativeWebView/pch.h +37 -0
  120. package/windows/ReactNativeWebView.sln +185 -0
@@ -0,0 +1,242 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT License.
3
+
4
+ #include "pch.h"
5
+
6
+ #ifndef USE_WINUI3
7
+
8
+ #include "JSValueXaml.h"
9
+ #include "ReactWebView.h"
10
+ #include "ReactWebView.g.cpp"
11
+ #include <winrt/Windows.Foundation.Metadata.h>
12
+ #include <optional>
13
+
14
+ namespace winrt {
15
+ using namespace Microsoft::ReactNative;
16
+ using namespace Windows::Data::Json;
17
+ using namespace Windows::Foundation;
18
+ using namespace Windows::UI;
19
+ using namespace Windows::UI::Popups;
20
+ using namespace Windows::UI::Xaml;
21
+ using namespace Windows::UI::Xaml::Controls;
22
+ using namespace Windows::UI::Xaml::Input;
23
+ using namespace Windows::UI::Xaml::Media;
24
+ } // namespace winrt
25
+
26
+ namespace winrt::ReactNativeWebView::implementation {
27
+
28
+ ReactWebView::ReactWebView(winrt::IReactContext const& reactContext) : m_reactContext(reactContext) {
29
+ m_webView = winrt::WebView();
30
+ this->Content(m_webView);
31
+ RegisterEvents();
32
+ }
33
+
34
+ ReactWebView::~ReactWebView()
35
+ {
36
+ if (m_messagingEnabled) {
37
+ m_webBridge.MessagePostEvent(m_messageToken);
38
+ }
39
+ }
40
+
41
+ void ReactWebView::RegisterEvents() {
42
+ m_navigationStartingRevoker = m_webView.NavigationStarting(
43
+ winrt::auto_revoke, [ref = get_weak()](auto const& sender, auto const& args) {
44
+ if (auto self = ref.get()) {
45
+ self->OnNavigationStarting(sender, args);
46
+ }
47
+
48
+ });
49
+
50
+ m_navigationCompletedRevoker = m_webView.NavigationCompleted(
51
+ winrt::auto_revoke, [ref = get_weak()](auto const& sender, auto const& args) {
52
+ if (auto self = ref.get()) {
53
+ self->OnNavigationCompleted(sender, args);
54
+ }
55
+ });
56
+
57
+ m_navigationFailedRevoker = m_webView.NavigationFailed(
58
+ winrt::auto_revoke, [ref = get_weak()](auto const& sender, auto const& args) {
59
+ if (auto self = ref.get()) {
60
+ self->OnNavigationFailed(sender, args);
61
+ }
62
+ });
63
+
64
+ m_domContentLoadedRevoker = m_webView.DOMContentLoaded(
65
+ winrt::auto_revoke, [ref = get_weak()](auto const& sender, auto const& args) {
66
+ if (auto self = ref.get())
67
+ {
68
+ self->OnDOMContentLoaded(sender, args);
69
+ }
70
+ });
71
+ }
72
+
73
+ bool ReactWebView::Is17763OrHigher() {
74
+ static std::optional<bool> hasUniversalAPIContract_v7;
75
+
76
+ if (!hasUniversalAPIContract_v7.has_value()) {
77
+ hasUniversalAPIContract_v7 = winrt::Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent(L"Windows.Foundation.UniversalApiContract", 7);
78
+ }
79
+ return hasUniversalAPIContract_v7.value();
80
+ }
81
+
82
+ void ReactWebView::WriteWebViewNavigationEventArg(winrt::WebView const& sender, winrt::IJSValueWriter const& eventDataWriter) {
83
+ auto tag = this->GetValue(winrt::FrameworkElement::TagProperty()).as<winrt::IPropertyValue>().GetInt64();
84
+ WriteProperty(eventDataWriter, L"canGoBack", sender.CanGoBack());
85
+ WriteProperty(eventDataWriter, L"canGoForward", sender.CanGoForward());
86
+ if (Is17763OrHigher()) {
87
+ WriteProperty(eventDataWriter, L"loading", !sender.IsLoaded());
88
+ }
89
+ WriteProperty(eventDataWriter, L"target", tag);
90
+ WriteProperty(eventDataWriter, L"title", sender.DocumentTitle());
91
+ if (auto uri = sender.Source()) {
92
+ WriteProperty(eventDataWriter, L"url", uri.AbsoluteCanonicalUri());
93
+ }
94
+ }
95
+
96
+ void ReactWebView::OnNavigationStarting(winrt::WebView const& webView, winrt::WebViewNavigationStartingEventArgs const& /*args*/) {
97
+ m_reactContext.DispatchEvent(
98
+ *this,
99
+ L"topLoadingStart",
100
+ [&](winrt::IJSValueWriter const& eventDataWriter) noexcept {
101
+ eventDataWriter.WriteObjectBegin();
102
+ WriteWebViewNavigationEventArg(webView, eventDataWriter);
103
+ eventDataWriter.WriteObjectEnd();
104
+ });
105
+
106
+ if (m_messagingEnabled) {
107
+ m_webBridge = WebBridge();
108
+ m_messageToken = m_webBridge.MessagePostEvent([this](const auto&, hstring const& message)
109
+ {
110
+ this->OnMessagePosted(message);
111
+ });
112
+ webView.AddWebAllowedObject(L"__REACT_WEB_VIEW_BRIDGE", m_webBridge);
113
+ }
114
+ }
115
+
116
+ void ReactWebView::OnMessagePosted(hstring const& message)
117
+ {
118
+ HandleMessageFromJS(message);
119
+ }
120
+
121
+ void ReactWebView::OnNavigationCompleted(winrt::WebView const& webView, winrt::WebViewNavigationCompletedEventArgs const& /*args*/) {
122
+ m_reactContext.DispatchEvent(
123
+ *this,
124
+ L"topLoadingFinish",
125
+ [&](winrt::IJSValueWriter const& eventDataWriter) noexcept {
126
+ eventDataWriter.WriteObjectBegin();
127
+ WriteWebViewNavigationEventArg(webView, eventDataWriter);
128
+ eventDataWriter.WriteObjectEnd();
129
+ });
130
+
131
+ if (m_messagingEnabled) {
132
+ winrt::hstring windowAlert =
133
+ L"window.alert = function (msg) "
134
+ L"{__REACT_WEB_VIEW_BRIDGE.postMessage(`{\"type\":\"__alert\",\"message\":\"${msg}\"}`)};";
135
+ winrt::hstring postMessage =
136
+ L"window.postMessage = function (data) "
137
+ L"{__REACT_WEB_VIEW_BRIDGE.postMessage(typeof data == 'string' ? data : JSON.stringify(data))};";
138
+ winrt::hstring reactNativeWebviewPostMessage =
139
+ L"window.ReactNativeWebView = {postMessage: function (data) "
140
+ L"{__REACT_WEB_VIEW_BRIDGE.postMessage(typeof data == 'string' ? data : JSON.stringify(data))}};";
141
+ webView.InvokeScriptAsync(L"eval", {windowAlert + postMessage + reactNativeWebviewPostMessage});
142
+ }
143
+ }
144
+
145
+ void ReactWebView::OnNavigationFailed(winrt::IInspectable const& /*sender*/, winrt::WebViewNavigationFailedEventArgs const& args) {
146
+ m_reactContext.DispatchEvent(
147
+ *this,
148
+ L"topLoadingError",
149
+ [&](winrt::IJSValueWriter const& eventDataWriter) noexcept {
150
+ auto httpCode = static_cast<int32_t>(args.WebErrorStatus());
151
+ eventDataWriter.WriteObjectBegin();
152
+ {
153
+ WriteProperty(eventDataWriter, L"code", httpCode);
154
+ WriteWebViewNavigationEventArg(m_webView, eventDataWriter);
155
+ }
156
+ eventDataWriter.WriteObjectEnd();
157
+ });
158
+ }
159
+
160
+ void ReactWebView::HandleMessageFromJS(winrt::hstring const& message) {
161
+ winrt::JsonObject jsonObject;
162
+ if (winrt::JsonObject::TryParse(message, jsonObject)) {
163
+ if (auto v = jsonObject.Lookup(L"type"); v && v.ValueType() == JsonValueType::String) {
164
+ auto type = v.GetString();
165
+ if (type == L"__alert") {
166
+ auto dialog = winrt::MessageDialog(jsonObject.GetNamedString(L"message"));
167
+ dialog.Commands().Append(winrt::UICommand(L"OK"));
168
+ dialog.ShowAsync();
169
+ return;
170
+ }
171
+ }
172
+ }
173
+
174
+ m_reactContext.DispatchEvent(
175
+ *this,
176
+ L"topMessage",
177
+ [&](winrt::Microsoft::ReactNative::IJSValueWriter const& eventDataWriter) noexcept {
178
+ eventDataWriter.WriteObjectBegin();
179
+ {
180
+ WriteProperty(eventDataWriter, L"data", message);
181
+ }
182
+ eventDataWriter.WriteObjectEnd();
183
+ });
184
+ }
185
+
186
+ void ReactWebView::PostMessage(winrt::hstring const& message) {
187
+ if (m_messagingEnabled) {
188
+ HandleMessageFromJS(message);
189
+ }
190
+ }
191
+
192
+ void ReactWebView::OnDOMContentLoaded(winrt::WebView const& webView, winrt::WebViewDOMContentLoadedEventArgs const& /*args*/)
193
+ {
194
+ m_reactContext.DispatchEvent(
195
+ *this,
196
+ L"topDOMContentLoaded",
197
+ [&](winrt::IJSValueWriter const& eventDataWriter) noexcept
198
+ {
199
+ eventDataWriter.WriteObjectBegin();
200
+ WriteWebViewNavigationEventArg(webView, eventDataWriter);
201
+ eventDataWriter.WriteObjectEnd();
202
+ });
203
+ // Polyfill for missing globalThis:
204
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis
205
+ webView.InvokeScriptAsync(
206
+ L"eval", {L"if(typeof globalThis === 'undefined') { var globalThis = Function('return this')(); }"});
207
+ // Polyfill for missing BigInt:
208
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt
209
+ webView.InvokeScriptAsync(L"eval", {L"window.BigInt = function (data) { return Number(parseFloat(data)); }"});
210
+ // Polyfill for missing DOMRect: https://developer.mozilla.org/en-US/docs/Web/API/DOMRect
211
+ webView.InvokeScriptAsync(
212
+ L"eval",
213
+ {L"window.DOMRect = function (x = 0, y = 0, width = 0, height = 0) { return Object.assign({ x: x, y: y, "
214
+ L"height: height, width: width, top: ((y > 0) ? y : (y + height)), right: ((x > 0) ? (x + width) : x), "
215
+ L"bottom: ((y > 0) ? (y + height) : y), left: ((x > 0) ? x : (x + width)) }); }"});
216
+ if (!m_injectedJavascript.empty())
217
+ {
218
+ webView.InvokeScriptAsync(L"eval", {m_injectedJavascript});
219
+ }
220
+ }
221
+
222
+ void ReactWebView::SetInjectedJavascript(winrt::hstring const& payload)
223
+ {
224
+ m_injectedJavascript = payload;
225
+ }
226
+
227
+ void ReactWebView::RequestFocus()
228
+ {
229
+ FocusManager::TryFocusAsync(m_webView, FocusState::Programmatic);
230
+ }
231
+
232
+
233
+ void ReactWebView::MessagingEnabled(bool enabled) noexcept{
234
+ m_messagingEnabled = enabled;
235
+ }
236
+
237
+ bool ReactWebView::MessagingEnabled() const noexcept{
238
+ return m_messagingEnabled;
239
+ }
240
+ } // namespace winrt::ReactNativeWebView::implementation
241
+
242
+ #endif // USE_WINUI3
@@ -0,0 +1,56 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT License.
3
+
4
+ #pragma once
5
+
6
+ #ifndef USE_WINUI3
7
+
8
+ #include "winrt/Microsoft.ReactNative.h"
9
+ #include "NativeModules.h"
10
+ #include "ReactWebView.g.h"
11
+
12
+ #include "winrt/ReactNativeWebView.h"
13
+
14
+ using namespace winrt::ReactNativeWebView;
15
+
16
+ namespace winrt::ReactNativeWebView::implementation {
17
+
18
+ class ReactWebView : public ReactWebViewT<ReactWebView> {
19
+ public:
20
+ ReactWebView(Microsoft::ReactNative::IReactContext const& reactContext);
21
+ void MessagingEnabled(bool enabled) noexcept;
22
+ bool MessagingEnabled() const noexcept;
23
+ void SetInjectedJavascript(winrt::hstring const& payload);
24
+ void RequestFocus();
25
+ void PostMessage(winrt::hstring const& message);
26
+ ~ReactWebView();
27
+
28
+ private:
29
+ bool m_messagingEnabled{ true };
30
+ winrt::Windows::UI::Xaml::Controls::WebView m_webView{ nullptr };
31
+ Microsoft::ReactNative::IReactContext m_reactContext{ nullptr };
32
+ WebBridge m_webBridge{ nullptr };
33
+ winrt::event_token m_messageToken;
34
+ winrt::hstring m_injectedJavascript;
35
+ winrt::Windows::UI::Xaml::Controls::WebView::NavigationStarting_revoker m_navigationStartingRevoker{};
36
+ winrt::Windows::UI::Xaml::Controls::WebView::NavigationCompleted_revoker m_navigationCompletedRevoker{};
37
+ winrt::Windows::UI::Xaml::Controls::WebView::NavigationFailed_revoker m_navigationFailedRevoker{};
38
+ winrt::Windows::UI::Xaml::Controls::WebView::DOMContentLoaded_revoker m_domContentLoadedRevoker{};
39
+
40
+ void HandleMessageFromJS(winrt::hstring const& message);
41
+ void RegisterEvents();
42
+ void WriteWebViewNavigationEventArg(winrt::Windows::UI::Xaml::Controls::WebView const& sender, winrt::Microsoft::ReactNative::IJSValueWriter const& eventDataWriter);
43
+ void OnDOMContentLoaded(winrt::Windows::UI::Xaml::Controls::WebView const& sender, winrt::Windows::UI::Xaml::Controls::WebViewDOMContentLoadedEventArgs const& args);
44
+ void OnNavigationStarting(winrt::Windows::UI::Xaml::Controls::WebView const& sender, winrt::Windows::UI::Xaml::Controls::WebViewNavigationStartingEventArgs const& args);
45
+ void OnNavigationCompleted(winrt::Windows::UI::Xaml::Controls::WebView const& sender, winrt::Windows::UI::Xaml::Controls::WebViewNavigationCompletedEventArgs const& args);
46
+ void OnNavigationFailed(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Controls::WebViewNavigationFailedEventArgs const& args);
47
+ void OnMessagePosted(hstring const& message);
48
+ bool Is17763OrHigher();
49
+ };
50
+ } // namespace winrt::ReactNativeWebView::implementation
51
+
52
+ namespace winrt::ReactNativeWebView::factory_implementation {
53
+ struct ReactWebView : ReactWebViewT<ReactWebView, implementation::ReactWebView> {};
54
+ } // namespace winrt::ReactNativeWebView::factory_implementation
55
+
56
+ #endif // USE_WINUI3
@@ -0,0 +1,31 @@
1
+ #include <NamespaceRedirect.h>
2
+
3
+ namespace ReactNativeWebView{
4
+ #if !defined(USE_WINUI3)
5
+ [default_interface]
6
+ runtimeclass ReactWebView : Windows.UI.Xaml.Controls.ContentPresenter{
7
+ ReactWebView(Microsoft.ReactNative.IReactContext context);
8
+ Boolean MessagingEnabled;
9
+ void SetInjectedJavascript(String payload);
10
+ void RequestFocus();
11
+ void PostMessage(String message);
12
+ };
13
+ #endif
14
+ #if __has_include(<VersionMacros.h>)
15
+ #include <VersionMacros.h>
16
+ #else
17
+ #define RNW_VERSION_AT_LEAST(x,y,z) false
18
+ #endif
19
+
20
+ #if RNW_VERSION_AT_LEAST(0,68,0) && (defined(WINUI2_HAS_WEBVIEW2) || defined(USE_WINUI3))
21
+ [default_interface]
22
+ runtimeclass ReactWebView2 : XAML_NAMESPACE.Controls.ContentPresenter{
23
+ ReactWebView2(Microsoft.ReactNative.IReactContext context);
24
+ void NavigateToHtml(String html);
25
+ void NavigateWithWebResourceRequest(Microsoft.ReactNative.IJSValueReader request);
26
+ String InjectedJavascript;
27
+ Boolean MessagingEnabled;
28
+ Boolean LinkHandlingEnabled;
29
+ };
30
+ #endif
31
+ } // namespace ReactNativeWebView