@react-native-ohos/react-native-webview 13.15.1-rc.1
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.
- package/LICENSE +21 -0
- package/README.OpenSource +11 -0
- package/README.md +13 -0
- package/harmony/rn_webview/BuildProfile.ets +17 -0
- package/harmony/rn_webview/OAT.xml +45 -0
- package/harmony/rn_webview/build-profile.json5 +28 -0
- package/harmony/rn_webview/hvigorfile.ts +1 -0
- package/harmony/rn_webview/index.ets +13 -0
- package/harmony/rn_webview/oh-package.json5 +13 -0
- package/harmony/rn_webview/src/main/cpp/CMakeLists.txt +9 -0
- package/harmony/rn_webview/src/main/cpp/WebViewPackage.h +17 -0
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/BaseReactNativeWebviewPackage.h +95 -0
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/components/RNCWebViewJSIBinder.h +119 -0
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebView.cpp +18 -0
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebView.h +16 -0
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebViewModule.cpp +17 -0
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebViewModule.h +16 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ComponentDescriptors.h +24 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/EventEmitters.cpp +241 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/EventEmitters.h +263 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/Props.cpp +103 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/Props.h +509 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ShadowNodes.cpp +17 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ShadowNodes.h +32 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/States.cpp +16 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/States.h +29 -0
- package/harmony/rn_webview/src/main/ets/CutomReference.ts +30 -0
- package/harmony/rn_webview/src/main/ets/Logger.ts +44 -0
- package/harmony/rn_webview/src/main/ets/Magic.ets +184 -0
- package/harmony/rn_webview/src/main/ets/RNCWebView.ets +571 -0
- package/harmony/rn_webview/src/main/ets/RNCWebViewPackage.ets +38 -0
- package/harmony/rn_webview/src/main/ets/ShouldRequestUrl.ts +48 -0
- package/harmony/rn_webview/src/main/ets/WebViewBaseOperate.ets +443 -0
- package/harmony/rn_webview/src/main/ets/WebViewTurboModule.ets +58 -0
- package/harmony/rn_webview/src/main/ets/generated/components/RNCWebView.ts +524 -0
- package/harmony/rn_webview/src/main/ets/generated/components/ts.ts +5 -0
- package/harmony/rn_webview/src/main/ets/generated/index.ets +5 -0
- package/harmony/rn_webview/src/main/ets/generated/ts.ts +6 -0
- package/harmony/rn_webview/src/main/ets/generated/turboModules/RNCWebView.ts +18 -0
- package/harmony/rn_webview/src/main/ets/generated/turboModules/RNCWebViewModule.ts +16 -0
- package/harmony/rn_webview/src/main/ets/generated/turboModules/ts.ts +6 -0
- package/harmony/rn_webview/src/main/module.json5 +11 -0
- package/harmony/rn_webview/src/main/resources/base/element/string.json +40 -0
- package/harmony/rn_webview/src/main/resources/en_US/element/string.json +40 -0
- package/harmony/rn_webview/src/main/resources/zh_CN/element/string.json +40 -0
- package/harmony/rn_webview/src/test/List.test.ets +5 -0
- package/harmony/rn_webview/src/test/LocalUnit.test.ets +33 -0
- package/harmony/rn_webview/ts.ets +9 -0
- package/harmony/rn_webview.har +0 -0
- package/package.json +99 -0
- package/src/NativeRNCWebView.ts +22 -0
- package/src/NativeRNCWebViewModule.ts +19 -0
- package/src/RNCWebViewNativeComponent.ts +354 -0
- package/src/WebView.harmony.tsx +343 -0
- package/src/WebView.tsx +10 -0
- package/src/codegenUtils.ts +11 -0
- package/src/index.ts +10 -0
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GeneratePropsH.js
|
|
9
|
+
*/
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <cinttypes>
|
|
13
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
14
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
15
|
+
#include <react/renderer/core/propsConversions.h>
|
|
16
|
+
#include <vector>
|
|
17
|
+
|
|
18
|
+
namespace facebook::react {
|
|
19
|
+
|
|
20
|
+
enum class RNCWebViewAndroidLayerType { None, Software, Hardware };
|
|
21
|
+
|
|
22
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNCWebViewAndroidLayerType &result) {
|
|
23
|
+
auto string = (std::string)value;
|
|
24
|
+
if (string == "none") { result = RNCWebViewAndroidLayerType::None; return; }
|
|
25
|
+
if (string == "software") { result = RNCWebViewAndroidLayerType::Software; return; }
|
|
26
|
+
if (string == "hardware") { result = RNCWebViewAndroidLayerType::Hardware; return; }
|
|
27
|
+
abort();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static inline std::string toString(const RNCWebViewAndroidLayerType &value) {
|
|
31
|
+
switch (value) {
|
|
32
|
+
case RNCWebViewAndroidLayerType::None: return "none";
|
|
33
|
+
case RNCWebViewAndroidLayerType::Software: return "software";
|
|
34
|
+
case RNCWebViewAndroidLayerType::Hardware: return "hardware";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
enum class RNCWebViewCacheMode { LOAD_DEFAULT, LOAD_CACHE_ELSE_NETWORK, LOAD_NO_CACHE, LOAD_CACHE_ONLY };
|
|
38
|
+
|
|
39
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNCWebViewCacheMode &result) {
|
|
40
|
+
auto string = (std::string)value;
|
|
41
|
+
if (string == "LOAD_DEFAULT") { result = RNCWebViewCacheMode::LOAD_DEFAULT; return; }
|
|
42
|
+
if (string == "LOAD_CACHE_ELSE_NETWORK") { result = RNCWebViewCacheMode::LOAD_CACHE_ELSE_NETWORK; return; }
|
|
43
|
+
if (string == "LOAD_NO_CACHE") { result = RNCWebViewCacheMode::LOAD_NO_CACHE; return; }
|
|
44
|
+
if (string == "LOAD_CACHE_ONLY") { result = RNCWebViewCacheMode::LOAD_CACHE_ONLY; return; }
|
|
45
|
+
abort();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static inline std::string toString(const RNCWebViewCacheMode &value) {
|
|
49
|
+
switch (value) {
|
|
50
|
+
case RNCWebViewCacheMode::LOAD_DEFAULT: return "LOAD_DEFAULT";
|
|
51
|
+
case RNCWebViewCacheMode::LOAD_CACHE_ELSE_NETWORK: return "LOAD_CACHE_ELSE_NETWORK";
|
|
52
|
+
case RNCWebViewCacheMode::LOAD_NO_CACHE: return "LOAD_NO_CACHE";
|
|
53
|
+
case RNCWebViewCacheMode::LOAD_CACHE_ONLY: return "LOAD_CACHE_ONLY";
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
enum class RNCWebViewMixedContentMode { Never, Always, Compatibility };
|
|
57
|
+
|
|
58
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNCWebViewMixedContentMode &result) {
|
|
59
|
+
auto string = (std::string)value;
|
|
60
|
+
if (string == "never") { result = RNCWebViewMixedContentMode::Never; return; }
|
|
61
|
+
if (string == "always") { result = RNCWebViewMixedContentMode::Always; return; }
|
|
62
|
+
if (string == "compatibility") { result = RNCWebViewMixedContentMode::Compatibility; return; }
|
|
63
|
+
abort();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static inline std::string toString(const RNCWebViewMixedContentMode &value) {
|
|
67
|
+
switch (value) {
|
|
68
|
+
case RNCWebViewMixedContentMode::Never: return "never";
|
|
69
|
+
case RNCWebViewMixedContentMode::Always: return "always";
|
|
70
|
+
case RNCWebViewMixedContentMode::Compatibility: return "compatibility";
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
enum class RNCWebViewContentInsetAdjustmentBehavior { Never, Automatic, ScrollableAxes, Always };
|
|
74
|
+
|
|
75
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNCWebViewContentInsetAdjustmentBehavior &result) {
|
|
76
|
+
auto string = (std::string)value;
|
|
77
|
+
if (string == "never") { result = RNCWebViewContentInsetAdjustmentBehavior::Never; return; }
|
|
78
|
+
if (string == "automatic") { result = RNCWebViewContentInsetAdjustmentBehavior::Automatic; return; }
|
|
79
|
+
if (string == "scrollableAxes") { result = RNCWebViewContentInsetAdjustmentBehavior::ScrollableAxes; return; }
|
|
80
|
+
if (string == "always") { result = RNCWebViewContentInsetAdjustmentBehavior::Always; return; }
|
|
81
|
+
abort();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static inline std::string toString(const RNCWebViewContentInsetAdjustmentBehavior &value) {
|
|
85
|
+
switch (value) {
|
|
86
|
+
case RNCWebViewContentInsetAdjustmentBehavior::Never: return "never";
|
|
87
|
+
case RNCWebViewContentInsetAdjustmentBehavior::Automatic: return "automatic";
|
|
88
|
+
case RNCWebViewContentInsetAdjustmentBehavior::ScrollableAxes: return "scrollableAxes";
|
|
89
|
+
case RNCWebViewContentInsetAdjustmentBehavior::Always: return "always";
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
enum class RNCWebViewContentMode { Recommended, Mobile, Desktop };
|
|
93
|
+
|
|
94
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNCWebViewContentMode &result) {
|
|
95
|
+
auto string = (std::string)value;
|
|
96
|
+
if (string == "recommended") { result = RNCWebViewContentMode::Recommended; return; }
|
|
97
|
+
if (string == "mobile") { result = RNCWebViewContentMode::Mobile; return; }
|
|
98
|
+
if (string == "desktop") { result = RNCWebViewContentMode::Desktop; return; }
|
|
99
|
+
abort();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
static inline std::string toString(const RNCWebViewContentMode &value) {
|
|
103
|
+
switch (value) {
|
|
104
|
+
case RNCWebViewContentMode::Recommended: return "recommended";
|
|
105
|
+
case RNCWebViewContentMode::Mobile: return "mobile";
|
|
106
|
+
case RNCWebViewContentMode::Desktop: return "desktop";
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
using RNCWebViewDataDetectorTypesMask = uint32_t;
|
|
110
|
+
|
|
111
|
+
struct RNCWebViewDataDetectorTypesMaskWrapped {
|
|
112
|
+
RNCWebViewDataDetectorTypesMask value;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
enum class RNCWebViewDataDetectorTypes: RNCWebViewDataDetectorTypesMask {
|
|
116
|
+
Address = 1 << 0,
|
|
117
|
+
Link = 1 << 1,
|
|
118
|
+
CalendarEvent = 1 << 2,
|
|
119
|
+
TrackingNumber = 1 << 3,
|
|
120
|
+
FlightNumber = 1 << 4,
|
|
121
|
+
LookupSuggestion = 1 << 5,
|
|
122
|
+
PhoneNumber = 1 << 6,
|
|
123
|
+
All = 1 << 7,
|
|
124
|
+
None = 1 << 8
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
constexpr bool operator&(
|
|
128
|
+
RNCWebViewDataDetectorTypesMask const lhs,
|
|
129
|
+
enum RNCWebViewDataDetectorTypes const rhs) {
|
|
130
|
+
return lhs & static_cast<RNCWebViewDataDetectorTypesMask>(rhs);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
constexpr RNCWebViewDataDetectorTypesMask operator|(
|
|
134
|
+
RNCWebViewDataDetectorTypesMask const lhs,
|
|
135
|
+
enum RNCWebViewDataDetectorTypes const rhs) {
|
|
136
|
+
return lhs | static_cast<RNCWebViewDataDetectorTypesMask>(rhs);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
constexpr void operator|=(
|
|
140
|
+
RNCWebViewDataDetectorTypesMask &lhs,
|
|
141
|
+
enum RNCWebViewDataDetectorTypes const rhs) {
|
|
142
|
+
lhs = lhs | static_cast<RNCWebViewDataDetectorTypesMask>(rhs);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNCWebViewDataDetectorTypesMaskWrapped &wrapped) {
|
|
146
|
+
auto items = std::vector<std::string>{value};
|
|
147
|
+
for (const auto &item : items) {
|
|
148
|
+
if (item == "address") {
|
|
149
|
+
wrapped.value |= RNCWebViewDataDetectorTypes::Address;
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
if (item == "link") {
|
|
153
|
+
wrapped.value |= RNCWebViewDataDetectorTypes::Link;
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
if (item == "calendarEvent") {
|
|
157
|
+
wrapped.value |= RNCWebViewDataDetectorTypes::CalendarEvent;
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
if (item == "trackingNumber") {
|
|
161
|
+
wrapped.value |= RNCWebViewDataDetectorTypes::TrackingNumber;
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
if (item == "flightNumber") {
|
|
165
|
+
wrapped.value |= RNCWebViewDataDetectorTypes::FlightNumber;
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
if (item == "lookupSuggestion") {
|
|
169
|
+
wrapped.value |= RNCWebViewDataDetectorTypes::LookupSuggestion;
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
if (item == "phoneNumber") {
|
|
173
|
+
wrapped.value |= RNCWebViewDataDetectorTypes::PhoneNumber;
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
if (item == "all") {
|
|
177
|
+
wrapped.value |= RNCWebViewDataDetectorTypes::All;
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
if (item == "none") {
|
|
181
|
+
wrapped.value |= RNCWebViewDataDetectorTypes::None;
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
abort();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
static inline std::string toString(const RNCWebViewDataDetectorTypesMaskWrapped &wrapped) {
|
|
189
|
+
auto result = std::string{};
|
|
190
|
+
auto separator = std::string{", "};
|
|
191
|
+
|
|
192
|
+
if (wrapped.value & RNCWebViewDataDetectorTypes::Address) {
|
|
193
|
+
result += "address" + separator;
|
|
194
|
+
}
|
|
195
|
+
if (wrapped.value & RNCWebViewDataDetectorTypes::Link) {
|
|
196
|
+
result += "link" + separator;
|
|
197
|
+
}
|
|
198
|
+
if (wrapped.value & RNCWebViewDataDetectorTypes::CalendarEvent) {
|
|
199
|
+
result += "calendarEvent" + separator;
|
|
200
|
+
}
|
|
201
|
+
if (wrapped.value & RNCWebViewDataDetectorTypes::TrackingNumber) {
|
|
202
|
+
result += "trackingNumber" + separator;
|
|
203
|
+
}
|
|
204
|
+
if (wrapped.value & RNCWebViewDataDetectorTypes::FlightNumber) {
|
|
205
|
+
result += "flightNumber" + separator;
|
|
206
|
+
}
|
|
207
|
+
if (wrapped.value & RNCWebViewDataDetectorTypes::LookupSuggestion) {
|
|
208
|
+
result += "lookupSuggestion" + separator;
|
|
209
|
+
}
|
|
210
|
+
if (wrapped.value & RNCWebViewDataDetectorTypes::PhoneNumber) {
|
|
211
|
+
result += "phoneNumber" + separator;
|
|
212
|
+
}
|
|
213
|
+
if (wrapped.value & RNCWebViewDataDetectorTypes::All) {
|
|
214
|
+
result += "all" + separator;
|
|
215
|
+
}
|
|
216
|
+
if (wrapped.value & RNCWebViewDataDetectorTypes::None) {
|
|
217
|
+
result += "none" + separator;
|
|
218
|
+
}
|
|
219
|
+
if (!result.empty()) {
|
|
220
|
+
result.erase(result.length() - separator.length());
|
|
221
|
+
}
|
|
222
|
+
return result;
|
|
223
|
+
}
|
|
224
|
+
enum class RNCWebViewMediaCapturePermissionGrantType { Prompt, Grant, Deny, GrantIfSameHostElsePrompt, GrantIfSameHostElseDeny };
|
|
225
|
+
|
|
226
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNCWebViewMediaCapturePermissionGrantType &result) {
|
|
227
|
+
auto string = (std::string)value;
|
|
228
|
+
if (string == "prompt") { result = RNCWebViewMediaCapturePermissionGrantType::Prompt; return; }
|
|
229
|
+
if (string == "grant") { result = RNCWebViewMediaCapturePermissionGrantType::Grant; return; }
|
|
230
|
+
if (string == "deny") { result = RNCWebViewMediaCapturePermissionGrantType::Deny; return; }
|
|
231
|
+
if (string == "grantIfSameHostElsePrompt") { result = RNCWebViewMediaCapturePermissionGrantType::GrantIfSameHostElsePrompt; return; }
|
|
232
|
+
if (string == "grantIfSameHostElseDeny") { result = RNCWebViewMediaCapturePermissionGrantType::GrantIfSameHostElseDeny; return; }
|
|
233
|
+
abort();
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
static inline std::string toString(const RNCWebViewMediaCapturePermissionGrantType &value) {
|
|
237
|
+
switch (value) {
|
|
238
|
+
case RNCWebViewMediaCapturePermissionGrantType::Prompt: return "prompt";
|
|
239
|
+
case RNCWebViewMediaCapturePermissionGrantType::Grant: return "grant";
|
|
240
|
+
case RNCWebViewMediaCapturePermissionGrantType::Deny: return "deny";
|
|
241
|
+
case RNCWebViewMediaCapturePermissionGrantType::GrantIfSameHostElsePrompt: return "grantIfSameHostElsePrompt";
|
|
242
|
+
case RNCWebViewMediaCapturePermissionGrantType::GrantIfSameHostElseDeny: return "grantIfSameHostElseDeny";
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
enum class RNCWebViewIndicatorStyle { Default, Black, White };
|
|
246
|
+
|
|
247
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNCWebViewIndicatorStyle &result) {
|
|
248
|
+
auto string = (std::string)value;
|
|
249
|
+
if (string == "default") { result = RNCWebViewIndicatorStyle::Default; return; }
|
|
250
|
+
if (string == "black") { result = RNCWebViewIndicatorStyle::Black; return; }
|
|
251
|
+
if (string == "white") { result = RNCWebViewIndicatorStyle::White; return; }
|
|
252
|
+
abort();
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
static inline std::string toString(const RNCWebViewIndicatorStyle &value) {
|
|
256
|
+
switch (value) {
|
|
257
|
+
case RNCWebViewIndicatorStyle::Default: return "default";
|
|
258
|
+
case RNCWebViewIndicatorStyle::Black: return "black";
|
|
259
|
+
case RNCWebViewIndicatorStyle::White: return "white";
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
struct RNCWebViewContentInsetStruct {
|
|
263
|
+
double top{0.0};
|
|
264
|
+
double left{0.0};
|
|
265
|
+
double bottom{0.0};
|
|
266
|
+
double right{0.0};
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNCWebViewContentInsetStruct &result) {
|
|
270
|
+
auto map = (std::unordered_map<std::string, RawValue>)value;
|
|
271
|
+
|
|
272
|
+
auto tmp_top = map.find("top");
|
|
273
|
+
if (tmp_top != map.end()) {
|
|
274
|
+
fromRawValue(context, tmp_top->second, result.top);
|
|
275
|
+
}
|
|
276
|
+
auto tmp_left = map.find("left");
|
|
277
|
+
if (tmp_left != map.end()) {
|
|
278
|
+
fromRawValue(context, tmp_left->second, result.left);
|
|
279
|
+
}
|
|
280
|
+
auto tmp_bottom = map.find("bottom");
|
|
281
|
+
if (tmp_bottom != map.end()) {
|
|
282
|
+
fromRawValue(context, tmp_bottom->second, result.bottom);
|
|
283
|
+
}
|
|
284
|
+
auto tmp_right = map.find("right");
|
|
285
|
+
if (tmp_right != map.end()) {
|
|
286
|
+
fromRawValue(context, tmp_right->second, result.right);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
static inline std::string toString(const RNCWebViewContentInsetStruct &value) {
|
|
291
|
+
return "[Object RNCWebViewContentInsetStruct]";
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
struct RNCWebViewMenuItemsStruct {
|
|
295
|
+
std::string label{};
|
|
296
|
+
std::string key{};
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNCWebViewMenuItemsStruct &result) {
|
|
300
|
+
auto map = (std::unordered_map<std::string, RawValue>)value;
|
|
301
|
+
|
|
302
|
+
auto tmp_label = map.find("label");
|
|
303
|
+
if (tmp_label != map.end()) {
|
|
304
|
+
fromRawValue(context, tmp_label->second, result.label);
|
|
305
|
+
}
|
|
306
|
+
auto tmp_key = map.find("key");
|
|
307
|
+
if (tmp_key != map.end()) {
|
|
308
|
+
fromRawValue(context, tmp_key->second, result.key);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
static inline std::string toString(const RNCWebViewMenuItemsStruct &value) {
|
|
313
|
+
return "[Object RNCWebViewMenuItemsStruct]";
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, std::vector<RNCWebViewMenuItemsStruct> &result) {
|
|
317
|
+
auto items = (std::vector<RawValue>)value;
|
|
318
|
+
for (const auto &item : items) {
|
|
319
|
+
RNCWebViewMenuItemsStruct newItem;
|
|
320
|
+
fromRawValue(context, item, newItem);
|
|
321
|
+
result.emplace_back(newItem);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
struct RNCWebViewBasicAuthCredentialStruct {
|
|
327
|
+
std::string username{};
|
|
328
|
+
std::string password{};
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNCWebViewBasicAuthCredentialStruct &result) {
|
|
332
|
+
auto map = (std::unordered_map<std::string, RawValue>)value;
|
|
333
|
+
|
|
334
|
+
auto tmp_username = map.find("username");
|
|
335
|
+
if (tmp_username != map.end()) {
|
|
336
|
+
fromRawValue(context, tmp_username->second, result.username);
|
|
337
|
+
}
|
|
338
|
+
auto tmp_password = map.find("password");
|
|
339
|
+
if (tmp_password != map.end()) {
|
|
340
|
+
fromRawValue(context, tmp_password->second, result.password);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
static inline std::string toString(const RNCWebViewBasicAuthCredentialStruct &value) {
|
|
345
|
+
return "[Object RNCWebViewBasicAuthCredentialStruct]";
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
struct RNCWebViewNewSourceHeadersStruct {
|
|
349
|
+
std::string name{};
|
|
350
|
+
std::string value{};
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNCWebViewNewSourceHeadersStruct &result) {
|
|
354
|
+
auto map = (std::unordered_map<std::string, RawValue>)value;
|
|
355
|
+
|
|
356
|
+
auto tmp_name = map.find("name");
|
|
357
|
+
if (tmp_name != map.end()) {
|
|
358
|
+
fromRawValue(context, tmp_name->second, result.name);
|
|
359
|
+
}
|
|
360
|
+
auto tmp_value = map.find("value");
|
|
361
|
+
if (tmp_value != map.end()) {
|
|
362
|
+
fromRawValue(context, tmp_value->second, result.value);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
static inline std::string toString(const RNCWebViewNewSourceHeadersStruct &value) {
|
|
367
|
+
return "[Object RNCWebViewNewSourceHeadersStruct]";
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, std::vector<RNCWebViewNewSourceHeadersStruct> &result) {
|
|
371
|
+
auto items = (std::vector<RawValue>)value;
|
|
372
|
+
for (const auto &item : items) {
|
|
373
|
+
RNCWebViewNewSourceHeadersStruct newItem;
|
|
374
|
+
fromRawValue(context, item, newItem);
|
|
375
|
+
result.emplace_back(newItem);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
struct RNCWebViewNewSourceStruct {
|
|
381
|
+
std::string uri{};
|
|
382
|
+
std::string method{};
|
|
383
|
+
std::string body{};
|
|
384
|
+
std::vector<RNCWebViewNewSourceHeadersStruct> headers{};
|
|
385
|
+
std::string html{};
|
|
386
|
+
std::string baseUrl{};
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNCWebViewNewSourceStruct &result) {
|
|
390
|
+
auto map = (std::unordered_map<std::string, RawValue>)value;
|
|
391
|
+
|
|
392
|
+
auto tmp_uri = map.find("uri");
|
|
393
|
+
if (tmp_uri != map.end()) {
|
|
394
|
+
fromRawValue(context, tmp_uri->second, result.uri);
|
|
395
|
+
}
|
|
396
|
+
auto tmp_method = map.find("method");
|
|
397
|
+
if (tmp_method != map.end()) {
|
|
398
|
+
fromRawValue(context, tmp_method->second, result.method);
|
|
399
|
+
}
|
|
400
|
+
auto tmp_body = map.find("body");
|
|
401
|
+
if (tmp_body != map.end()) {
|
|
402
|
+
fromRawValue(context, tmp_body->second, result.body);
|
|
403
|
+
}
|
|
404
|
+
auto tmp_headers = map.find("headers");
|
|
405
|
+
if (tmp_headers != map.end()) {
|
|
406
|
+
fromRawValue(context, tmp_headers->second, result.headers);
|
|
407
|
+
}
|
|
408
|
+
auto tmp_html = map.find("html");
|
|
409
|
+
if (tmp_html != map.end()) {
|
|
410
|
+
fromRawValue(context, tmp_html->second, result.html);
|
|
411
|
+
}
|
|
412
|
+
auto tmp_baseUrl = map.find("baseUrl");
|
|
413
|
+
if (tmp_baseUrl != map.end()) {
|
|
414
|
+
fromRawValue(context, tmp_baseUrl->second, result.baseUrl);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
static inline std::string toString(const RNCWebViewNewSourceStruct &value) {
|
|
419
|
+
return "[Object RNCWebViewNewSourceStruct]";
|
|
420
|
+
}
|
|
421
|
+
class RNCWebViewProps final : public ViewProps {
|
|
422
|
+
public:
|
|
423
|
+
RNCWebViewProps() = default;
|
|
424
|
+
RNCWebViewProps(const PropsParserContext& context, const RNCWebViewProps &sourceProps, const RawProps &rawProps);
|
|
425
|
+
|
|
426
|
+
#pragma mark - Props
|
|
427
|
+
|
|
428
|
+
bool allowFileAccess{false};
|
|
429
|
+
bool allowsProtectedMedia{false};
|
|
430
|
+
bool allowsFullscreenVideo{false};
|
|
431
|
+
RNCWebViewAndroidLayerType androidLayerType{RNCWebViewAndroidLayerType::None};
|
|
432
|
+
RNCWebViewCacheMode cacheMode{RNCWebViewCacheMode::LOAD_DEFAULT};
|
|
433
|
+
bool domStorageEnabled{false};
|
|
434
|
+
std::string downloadingMessage{};
|
|
435
|
+
bool forceDarkOn{false};
|
|
436
|
+
bool geolocationEnabled{false};
|
|
437
|
+
std::string lackPermissionToDownloadMessage{};
|
|
438
|
+
std::string messagingModuleName{};
|
|
439
|
+
int minimumFontSize{0};
|
|
440
|
+
RNCWebViewMixedContentMode mixedContentMode{RNCWebViewMixedContentMode::Never};
|
|
441
|
+
bool nestedScrollEnabled{false};
|
|
442
|
+
std::string overScrollMode{};
|
|
443
|
+
bool saveFormDataDisabled{false};
|
|
444
|
+
bool scalesPageToFit{true};
|
|
445
|
+
bool setBuiltInZoomControls{true};
|
|
446
|
+
bool setDisplayZoomControls{false};
|
|
447
|
+
bool setSupportMultipleWindows{true};
|
|
448
|
+
int textZoom{0};
|
|
449
|
+
bool thirdPartyCookiesEnabled{true};
|
|
450
|
+
bool hasOnScroll{false};
|
|
451
|
+
std::string injectedJavaScriptObject{};
|
|
452
|
+
bool paymentRequestEnabled{false};
|
|
453
|
+
std::string allowingReadAccessToURL{};
|
|
454
|
+
bool allowsBackForwardNavigationGestures{false};
|
|
455
|
+
bool allowsInlineMediaPlayback{false};
|
|
456
|
+
bool allowsPictureInPictureMediaPlayback{false};
|
|
457
|
+
bool allowsAirPlayForMediaPlayback{false};
|
|
458
|
+
bool allowsLinkPreview{true};
|
|
459
|
+
bool automaticallyAdjustContentInsets{true};
|
|
460
|
+
bool ignoreSilentHardwareSwitch{false};
|
|
461
|
+
bool autoManageStatusBarEnabled{true};
|
|
462
|
+
bool bounces{true};
|
|
463
|
+
RNCWebViewContentInsetStruct contentInset{};
|
|
464
|
+
RNCWebViewContentInsetAdjustmentBehavior contentInsetAdjustmentBehavior{RNCWebViewContentInsetAdjustmentBehavior::Never};
|
|
465
|
+
RNCWebViewContentMode contentMode{RNCWebViewContentMode::Recommended};
|
|
466
|
+
RNCWebViewDataDetectorTypesMask dataDetectorTypes{static_cast<RNCWebViewDataDetectorTypesMask>(RNCWebViewDataDetectorTypes::PhoneNumber)};
|
|
467
|
+
double decelerationRate{0.0};
|
|
468
|
+
bool directionalLockEnabled{true};
|
|
469
|
+
bool enableApplePay{false};
|
|
470
|
+
bool hideKeyboardAccessoryView{false};
|
|
471
|
+
bool keyboardDisplayRequiresUserAction{true};
|
|
472
|
+
bool limitsNavigationsToAppBoundDomains{false};
|
|
473
|
+
RNCWebViewMediaCapturePermissionGrantType mediaCapturePermissionGrantType{RNCWebViewMediaCapturePermissionGrantType::Prompt};
|
|
474
|
+
bool pagingEnabled{false};
|
|
475
|
+
bool pullToRefreshEnabled{false};
|
|
476
|
+
bool refreshControlLightMode{false};
|
|
477
|
+
bool scrollEnabled{true};
|
|
478
|
+
bool sharedCookiesEnabled{false};
|
|
479
|
+
bool textInteractionEnabled{true};
|
|
480
|
+
bool useSharedProcessPool{true};
|
|
481
|
+
std::vector<RNCWebViewMenuItemsStruct> menuItems{};
|
|
482
|
+
std::vector<std::string> suppressMenuItems{};
|
|
483
|
+
bool hasOnFileDownload{false};
|
|
484
|
+
bool fraudulentWebsiteWarningEnabled{true};
|
|
485
|
+
bool allowFileAccessFromFileURLs{false};
|
|
486
|
+
bool allowUniversalAccessFromFileURLs{false};
|
|
487
|
+
std::string applicationNameForUserAgent{};
|
|
488
|
+
RNCWebViewBasicAuthCredentialStruct basicAuthCredential{};
|
|
489
|
+
bool cacheEnabled{true};
|
|
490
|
+
bool incognito{false};
|
|
491
|
+
std::string injectedJavaScript{};
|
|
492
|
+
std::string injectedJavaScriptBeforeContentLoaded{};
|
|
493
|
+
bool injectedJavaScriptForMainFrameOnly{true};
|
|
494
|
+
bool injectedJavaScriptBeforeContentLoadedForMainFrameOnly{true};
|
|
495
|
+
bool javaScriptCanOpenWindowsAutomatically{false};
|
|
496
|
+
bool javaScriptEnabled{true};
|
|
497
|
+
bool webviewDebuggingEnabled{false};
|
|
498
|
+
bool mediaPlaybackRequiresUserAction{true};
|
|
499
|
+
bool messagingEnabled{false};
|
|
500
|
+
bool shouldStartLoadWithRequestEnabled{false};
|
|
501
|
+
bool hasOnOpenWindowEvent{false};
|
|
502
|
+
bool showsHorizontalScrollIndicator{true};
|
|
503
|
+
bool showsVerticalScrollIndicator{true};
|
|
504
|
+
RNCWebViewIndicatorStyle indicatorStyle{RNCWebViewIndicatorStyle::Default};
|
|
505
|
+
RNCWebViewNewSourceStruct newSource{};
|
|
506
|
+
std::string userAgent{};
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateShadowNodeCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "ShadowNodes.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
extern const char RNCWebViewComponentName[] = "RNCWebView";
|
|
16
|
+
|
|
17
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateShadowNodeH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include "EventEmitters.h"
|
|
14
|
+
#include "Props.h"
|
|
15
|
+
#include "States.h"
|
|
16
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
17
|
+
#include <jsi/jsi.h>
|
|
18
|
+
|
|
19
|
+
namespace facebook::react {
|
|
20
|
+
|
|
21
|
+
JSI_EXPORT extern const char RNCWebViewComponentName[];
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* `ShadowNode` for <RNCWebView> component.
|
|
25
|
+
*/
|
|
26
|
+
using RNCWebViewShadowNode = ConcreteViewShadowNode<
|
|
27
|
+
RNCWebViewComponentName,
|
|
28
|
+
RNCWebViewProps,
|
|
29
|
+
RNCWebViewEventEmitter,
|
|
30
|
+
RNCWebViewState>;
|
|
31
|
+
|
|
32
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateStateCpp.js
|
|
9
|
+
*/
|
|
10
|
+
#include "States.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateStateH.js
|
|
8
|
+
*/
|
|
9
|
+
#pragma once
|
|
10
|
+
|
|
11
|
+
#ifdef ANDROID
|
|
12
|
+
#include <folly/dynamic.h>
|
|
13
|
+
#endif
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
class RNCWebViewState {
|
|
18
|
+
public:
|
|
19
|
+
RNCWebViewState() = default;
|
|
20
|
+
|
|
21
|
+
#ifdef ANDROID
|
|
22
|
+
RNCWebViewState(RNCWebViewState const &previousState, folly::dynamic data){};
|
|
23
|
+
folly::dynamic getDynamic() const {
|
|
24
|
+
return {};
|
|
25
|
+
};
|
|
26
|
+
#endif
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
2
|
+
// Use of this source code is governed by a Apache-2.0 license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
export class CustomReference {
|
|
6
|
+
private atomicValue: number;
|
|
7
|
+
private callBack!: Function;
|
|
8
|
+
constructor(init: number) {
|
|
9
|
+
this.atomicValue = init
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
getValue() {
|
|
13
|
+
return this.atomicValue
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
setCallBack(callBack: Function) {
|
|
17
|
+
this.callBack = callBack
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getCallBack() {
|
|
21
|
+
return this.callBack
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
setValue(newValue: number) {
|
|
25
|
+
this.atomicValue = newValue
|
|
26
|
+
if (this.callBack) {
|
|
27
|
+
this.callBack()
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
2
|
+
// Use of this source code is governed by a Apache-2.0 license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import hilog from '@ohos.hilog';
|
|
6
|
+
|
|
7
|
+
class Logger {
|
|
8
|
+
private domain: number;
|
|
9
|
+
private prefix: string;
|
|
10
|
+
private format: string = '%{public}s, %{public}s';
|
|
11
|
+
private isDebug: boolean;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* constructor.
|
|
15
|
+
*
|
|
16
|
+
* @param Prefix Identifies the log tag.
|
|
17
|
+
* @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF.
|
|
18
|
+
*/
|
|
19
|
+
constructor(prefix: string = 'MyApp', domain: number = 0xFF00, isDebug = false) {
|
|
20
|
+
this.prefix = prefix;
|
|
21
|
+
this.domain = domain;
|
|
22
|
+
this.isDebug = isDebug;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
debug(...args: string[]): void {
|
|
26
|
+
if (this.isDebug) {
|
|
27
|
+
hilog.debug(this.domain, this.prefix, this.format, args);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
info(...args: string[]): void {
|
|
32
|
+
hilog.info(this.domain, this.prefix, this.format, args);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
warn(...args: string[]): void {
|
|
36
|
+
hilog.warn(this.domain, this.prefix, this.format, args);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
error(...args: string[]): void {
|
|
40
|
+
hilog.error(this.domain, this.prefix, this.format, args);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default new Logger('WebView', 0xFF00, false)
|