@react-native-ohos/react-native-webview 13.10.6-beta.3 → 13.10.6

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 (62) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/LICENSE +21 -21
  3. package/README.md +385 -393
  4. package/harmony/rn_webview/.gitignore +6 -0
  5. package/harmony/rn_webview/BuildProfile.ets +1 -1
  6. package/harmony/rn_webview/LICENSE +21 -21
  7. package/harmony/rn_webview/NOTICE +33 -33
  8. package/harmony/rn_webview/OAT.xml +44 -44
  9. package/harmony/rn_webview/README.OpenSource +10 -10
  10. package/harmony/rn_webview/build-profile.json5 +28 -28
  11. package/harmony/rn_webview/index.ets +33 -33
  12. package/harmony/rn_webview/obfuscation-rules.txt +17 -17
  13. package/harmony/rn_webview/oh-package-lock.json5 +18 -18
  14. package/harmony/rn_webview/oh-package.json5 +13 -13
  15. package/harmony/rn_webview/src/main/cpp/CMakeLists.txt +9 -9
  16. package/harmony/rn_webview/src/main/cpp/WebViewPackage.h +36 -36
  17. package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/BaseReactNativeWebviewPackage.h +94 -94
  18. package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/components/RNCWebViewJSIBinder.h +129 -128
  19. package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebView.cpp +20 -20
  20. package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebView.h +16 -16
  21. package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebViewModule.cpp +19 -19
  22. package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebViewModule.h +16 -16
  23. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ComponentDescriptors.h +22 -22
  24. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/EventEmitters.cpp +240 -240
  25. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/EventEmitters.h +285 -285
  26. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/Props.cpp +156 -155
  27. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/Props.h +340 -339
  28. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ShadowNodes.cpp +19 -19
  29. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ShadowNodes.h +34 -34
  30. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/States.cpp +16 -16
  31. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/States.h +19 -19
  32. package/harmony/rn_webview/src/main/ets/CutomReference.ts +49 -49
  33. package/harmony/rn_webview/src/main/ets/Logger.ts +63 -63
  34. package/harmony/rn_webview/src/main/ets/Magic.ets +223 -221
  35. package/harmony/rn_webview/src/main/ets/RNCWebView.ets +1098 -903
  36. package/harmony/rn_webview/src/main/ets/RNCWebViewPackage.ets +65 -65
  37. package/harmony/rn_webview/src/main/ets/ShouldRequestUrl.ts +67 -67
  38. package/harmony/rn_webview/src/main/ets/WebViewBaseOperate.ets +490 -490
  39. package/harmony/rn_webview/src/main/ets/WebViewTurboModule.ets +81 -81
  40. package/harmony/rn_webview/src/main/ets/generated/components/RNCWebView.ts +516 -511
  41. package/harmony/rn_webview/src/main/ets/generated/components/ts.ts +5 -5
  42. package/harmony/rn_webview/src/main/ets/generated/index.ets +5 -5
  43. package/harmony/rn_webview/src/main/ets/generated/ts.ts +6 -6
  44. package/harmony/rn_webview/src/main/ets/generated/turboModules/RNCWebView.ts +18 -18
  45. package/harmony/rn_webview/src/main/ets/generated/turboModules/RNCWebViewModule.ts +16 -16
  46. package/harmony/rn_webview/src/main/ets/generated/turboModules/ts.ts +6 -6
  47. package/harmony/rn_webview/src/main/module.json5 +10 -10
  48. package/harmony/rn_webview/src/main/resources/base/element/string.json +39 -39
  49. package/harmony/rn_webview/src/main/resources/en_US/element/string.json +39 -39
  50. package/harmony/rn_webview/src/main/resources/zh_CN/element/string.json +39 -39
  51. package/harmony/rn_webview/src/test/List.test.ets +4 -4
  52. package/harmony/rn_webview/src/test/LocalUnit.test.ets +32 -32
  53. package/harmony/rn_webview/ts.ets +28 -28
  54. package/harmony/rn_webview.har +0 -0
  55. package/package.json +105 -104
  56. package/src/NativeRNCWebView.ts +15 -15
  57. package/src/NativeRNCWebViewModule.ts +17 -17
  58. package/src/RNCWebViewNativeComponent.ts +289 -288
  59. package/src/WebView.harmony.tsx +331 -331
  60. package/src/WebView.tsx +4 -4
  61. package/src/codegenUtils.ts +8 -8
  62. package/src/index.ts +4 -4
@@ -1,339 +1,340 @@
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 <react/renderer/components/view/ViewProps.h>
13
- #include <react/renderer/core/PropsParserContext.h>
14
- #include <vector>
15
-
16
- namespace facebook {
17
- namespace react {
18
- enum class RNCWebViewAndroidLayerType {
19
- None,
20
- Software,
21
- Hardware
22
- };
23
- static RNCWebViewAndroidLayerType parseAndroidLayerType(const std::string& string)
24
- {
25
- if (string == "none") {
26
- return RNCWebViewAndroidLayerType::None;
27
- }
28
- if (string == "software") {
29
- return RNCWebViewAndroidLayerType::Software;
30
- }
31
- if (string == "hardware") {
32
- return RNCWebViewAndroidLayerType::Hardware;
33
- }
34
- throw std::runtime_error("Unexpected value for RNCWebViewAndroidLayerType: " + string);
35
- }
36
- static inline void fromRawValue(const PropsParserContext &context, const RawValue &value,
37
- RNCWebViewAndroidLayerType &result)
38
- {
39
- auto string = (std::string)value;
40
- result = parseAndroidLayerType(string);
41
- }
42
-
43
- static inline std::string toString(const RNCWebViewAndroidLayerType &value)
44
- {
45
- switch (value) {
46
- case RNCWebViewAndroidLayerType::None:
47
- return "none";
48
- case RNCWebViewAndroidLayerType::Software:
49
- return "software";
50
- case RNCWebViewAndroidLayerType::Hardware:
51
- return "hardware";
52
- }
53
- }
54
- enum class RNCWebViewCacheMode {
55
- LOAD_DEFAULT,
56
- LOAD_CACHE_ELSE_NETWORK,
57
- LOAD_NO_CACHE,
58
- LOAD_CACHE_ONLY
59
- };
60
- static RNCWebViewCacheMode parseCacheMode(const std::string& string)
61
- {
62
- if (string == "LOAD_DEFAULT") {
63
- return RNCWebViewCacheMode::LOAD_DEFAULT;
64
- }
65
- if (string == "LOAD_CACHE_ELSE_NETWORK") {
66
- return RNCWebViewCacheMode::LOAD_CACHE_ELSE_NETWORK;
67
- }
68
- if (string == "LOAD_NO_CACHE") {
69
- return RNCWebViewCacheMode::LOAD_NO_CACHE;
70
- }
71
- if (string == "LOAD_CACHE_ONLY") {
72
- return RNCWebViewCacheMode::LOAD_CACHE_ONLY;
73
- }
74
- throw std::runtime_error("Unexpected value for RNCWebViewCacheMode: " + string);
75
- }
76
- static inline void fromRawValue(const PropsParserContext &context, const RawValue &value,
77
- RNCWebViewCacheMode &result)
78
- {
79
- auto string = (std::string)value;
80
- result = parseCacheMode(string);
81
- }
82
- static inline std::string toString(const RNCWebViewCacheMode &value)
83
- {
84
- switch (value) {
85
- case RNCWebViewCacheMode::LOAD_DEFAULT: return "LOAD_DEFAULT";
86
- case RNCWebViewCacheMode::LOAD_CACHE_ELSE_NETWORK: return "LOAD_CACHE_ELSE_NETWORK";
87
- case RNCWebViewCacheMode::LOAD_NO_CACHE: return "LOAD_NO_CACHE";
88
- case RNCWebViewCacheMode::LOAD_CACHE_ONLY: return "LOAD_CACHE_ONLY";
89
- }
90
- }
91
- enum class RNCWebViewMixedContentMode {
92
- Never,
93
- Always,
94
- Compatibility
95
- };
96
- static RNCWebViewMixedContentMode parseMixedContentMode(const std::string& string)
97
- {
98
- if (string == "never") {
99
- return RNCWebViewMixedContentMode::Never;
100
- }
101
- if (string == "always") {
102
- return RNCWebViewMixedContentMode::Always;
103
- }
104
- if (string == "compatibility") {
105
- return RNCWebViewMixedContentMode::Compatibility;
106
- }
107
- throw std::runtime_error("Unexpected value for RNCWebViewMixedContentMode: " + string);
108
- }
109
- static inline void fromRawValue(const PropsParserContext &context, const RawValue &value,
110
- RNCWebViewMixedContentMode &result)
111
- {
112
- auto string = (std::string)value;
113
- result = parseMixedContentMode(string);
114
- }
115
-
116
- static inline std::string toString(const RNCWebViewMixedContentMode &value)
117
- {
118
- switch (value) {
119
- case RNCWebViewMixedContentMode::Never:
120
- return "never";
121
- case RNCWebViewMixedContentMode::Always:
122
- return "always";
123
- case RNCWebViewMixedContentMode::Compatibility:
124
- return "compatibility";
125
- }
126
- }
127
- enum class RNCWebViewContentInsetAdjustmentBehavior {
128
- Never,
129
- Automatic,
130
- ScrollableAxes,
131
- Always
132
- };
133
- static RNCWebViewContentInsetAdjustmentBehavior parseBehavior(const std::string& string)
134
- {
135
- if (string == "never") {
136
- return RNCWebViewContentInsetAdjustmentBehavior::Never;
137
- }
138
- if (string == "automatic") {
139
- return RNCWebViewContentInsetAdjustmentBehavior::Automatic;
140
- }
141
- if (string == "scrollableAxes") {
142
- return RNCWebViewContentInsetAdjustmentBehavior::ScrollableAxes;
143
- }
144
- if (string == "always") {
145
- return RNCWebViewContentInsetAdjustmentBehavior::Always;
146
- }
147
- throw std::runtime_error("Unexpected value for RNCWebViewContentInsetAdjustmentBehavior: " + string);
148
- }
149
- static inline void fromRawValue(const PropsParserContext &context, const RawValue &value,
150
- RNCWebViewContentInsetAdjustmentBehavior &result)
151
- {
152
- auto string = (std::string)value;
153
- result = parseBehavior(string);
154
- }
155
- static inline std::string toString(const RNCWebViewContentInsetAdjustmentBehavior &value)
156
- {
157
- switch (value) {
158
- case RNCWebViewContentInsetAdjustmentBehavior::Never:
159
- return "never";
160
- case RNCWebViewContentInsetAdjustmentBehavior::Automatic:
161
- return "automatic";
162
- case RNCWebViewContentInsetAdjustmentBehavior::ScrollableAxes:
163
- return "scrollableAxes";
164
- case RNCWebViewContentInsetAdjustmentBehavior::Always:
165
- return "always";
166
- }
167
- }
168
- enum class RNCWebViewContentMode {
169
- Recommended,
170
- Mobile,
171
- Desktop
172
- };
173
- static RNCWebViewContentMode parseContentMode(const std::string& string)
174
- {
175
- if (string == "recommended") {
176
- return RNCWebViewContentMode::Recommended;
177
- }
178
- if (string == "mobile") {
179
- return RNCWebViewContentMode::Mobile;
180
- }
181
- if (string == "desktop") {
182
- return RNCWebViewContentMode::Desktop;
183
- }
184
- throw std::runtime_error("Unexpected value for RNCWebViewContentMode: " + string);
185
- }
186
- static inline void fromRawValue(const PropsParserContext &context, const RawValue &value,
187
- RNCWebViewContentMode &result)
188
- {
189
- auto string = (std::string)value;
190
- result = parseContentMode(string);
191
- }
192
- static inline std::string toString(const RNCWebViewContentMode &value)
193
- {
194
- switch (value) {
195
- case RNCWebViewContentMode::Recommended:
196
- return "recommended";
197
- case RNCWebViewContentMode::Mobile:
198
- return "mobile";
199
- case RNCWebViewContentMode::Desktop:
200
- return "desktop";
201
- }
202
- }
203
- enum class RNCWebViewMediaCapturePermissionGrantType {
204
- Prompt,
205
- Grant,
206
- Deny,
207
- GrantIfSameHostElsePrompt,
208
- GrantIfSameHostElseDeny
209
- };
210
- static RNCWebViewMediaCapturePermissionGrantType parseMCPGType(const std::string& string)
211
- {
212
- if (string == "prompt") {
213
- return RNCWebViewMediaCapturePermissionGrantType::Prompt;
214
- }
215
- if (string == "grant") {
216
- return RNCWebViewMediaCapturePermissionGrantType::Grant;
217
- }
218
- if (string == "deny") {
219
- return RNCWebViewMediaCapturePermissionGrantType::Deny;
220
- }
221
- if (string == "grantIfSameHostElsePrompt") {
222
- return RNCWebViewMediaCapturePermissionGrantType::GrantIfSameHostElsePrompt;
223
- }
224
- if (string == "grantIfSameHostElseDeny") {
225
- return RNCWebViewMediaCapturePermissionGrantType::GrantIfSameHostElseDeny;
226
- }
227
- throw std::runtime_error("Unexpected value for RNCWebViewMediaCapturePermissionGrantType: " + string);
228
- }
229
- static inline void fromRawValue(const PropsParserContext &context, const RawValue &value,
230
- RNCWebViewMediaCapturePermissionGrantType &result)
231
- {
232
- auto string = (std::string)value;
233
- result = parseMCPGType(string);
234
- }
235
- static inline std::string toString(const RNCWebViewMediaCapturePermissionGrantType &value)
236
- {
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:
242
- return "grantIfSameHostElsePrompt";
243
- case RNCWebViewMediaCapturePermissionGrantType::GrantIfSameHostElseDeny:
244
- return "grantIfSameHostElseDeny";
245
- }
246
- }
247
-
248
- class RNCWebViewProps final : public ViewProps {
249
- public:
250
- RNCWebViewProps() = default;
251
- RNCWebViewProps(const PropsParserContext &context, const RNCWebViewProps &sourceProps,
252
- const RawProps &rawProps);
253
-
254
- #pragma mark - Props
255
-
256
- bool allowFileAccess{false};
257
- bool allowsProtectedMedia{false};
258
- bool allowsFullscreenVideo{false};
259
- RNCWebViewAndroidLayerType androidLayerType{RNCWebViewAndroidLayerType::None};
260
- RNCWebViewCacheMode cacheMode{RNCWebViewCacheMode::LOAD_DEFAULT};
261
- bool domStorageEnabled{false};
262
- std::string downloadingMessage{};
263
- bool forceDarkOn{false};
264
- bool geolocationEnabled{false};
265
- std::string lackPermissionToDownloadMessage{};
266
- std::string messagingModuleName{};
267
- int minimumFontSize{0};
268
- RNCWebViewMixedContentMode mixedContentMode{RNCWebViewMixedContentMode::Never};
269
- bool nestedScrollEnabled{false};
270
- std::string overScrollMode{};
271
- bool saveFormDataDisabled{false};
272
- bool scalesPageToFit{false};
273
- bool setBuiltInZoomControls{false};
274
- bool setDisplayZoomControls{false};
275
- bool setSupportMultipleWindows{false};
276
- int textZoom{0};
277
- bool thirdPartyCookiesEnabled{false};
278
- bool hasOnScroll{false};
279
- std::string injectedJavaScriptObject{};
280
- std::string allowingReadAccessToURL{};
281
- bool allowsBackForwardNavigationGestures{false};
282
- bool allowsInlineMediaPlayback{false};
283
- bool allowsAirPlayForMediaPlayback{false};
284
- bool allowsLinkPreview{false};
285
- bool automaticallyAdjustContentInsets{false};
286
- bool ignoreSilentHardwareSwitch{false};
287
- bool autoManageStatusBarEnabled{false};
288
- bool bounces{false};
289
- folly::dynamic contentInset{};
290
- RNCWebViewContentInsetAdjustmentBehavior contentInsetAdjustmentBehavior{
291
- RNCWebViewContentInsetAdjustmentBehavior::Never};
292
- RNCWebViewContentMode contentMode{RNCWebViewContentMode::Recommended};
293
- folly::dynamic dataDetectorTypes{};
294
- double decelerationRate{0.0};
295
- bool directionalLockEnabled{false};
296
- bool enableApplePay{false};
297
- bool hideKeyboardAccessoryView{false};
298
- bool keyboardDisplayRequiresUserAction{false};
299
- bool limitsNavigationsToAppBoundDomains{false};
300
- RNCWebViewMediaCapturePermissionGrantType mediaCapturePermissionGrantType{
301
- RNCWebViewMediaCapturePermissionGrantType::Prompt};
302
- bool pagingEnabled{false};
303
- bool pullToRefreshEnabled{false};
304
- bool scrollEnabled{false};
305
- bool sharedCookiesEnabled{false};
306
- bool textInteractionEnabled{false};
307
- bool useSharedProcessPool{false};
308
- folly::dynamic menuItems{};
309
- std::vector<folly::dynamic> suppressMenuItems{};
310
- bool hasOnFileDownload{false};
311
- bool fraudulentWebsiteWarningEnabled{false};
312
- bool allowFileAccessFromFileURLs{false};
313
- bool allowUniversalAccessFromFileURLs{false};
314
- std::string applicationNameForUserAgent{};
315
- folly::dynamic basicAuthCredential{};
316
- bool cacheEnabled{false};
317
- bool incognito{false};
318
- std::string injectedJavaScript{};
319
- std::string injectedJavaScriptBeforeContentLoaded{};
320
- bool injectedJavaScriptForMainFrameOnly{false};
321
- bool injectedJavaScriptBeforeContentLoadedForMainFrameOnly{false};
322
- bool javaScriptCanOpenWindowsAutomatically{false};
323
- bool javaScriptEnabled{false};
324
- bool hasOnShouldStartLoadWithRequestEvent{false};
325
- folly::dynamic originWhitelist{};
326
- bool webviewDebuggingEnabled{false};
327
- bool mediaPlaybackRequiresUserAction{false};
328
- bool messagingEnabled{false};
329
- bool shouldStartLoadWithRequestEnabled{false};
330
- bool hasOnOpenWindowEvent{false};
331
- bool showsHorizontalScrollIndicator{false};
332
- bool showsVerticalScrollIndicator{false};
333
- folly::dynamic newSource{};
334
- std::string userAgent{};
335
- folly::dynamic schemeList{};
336
- };
337
-
338
- } // namespace react
339
- } // namespace facebook
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 <react/renderer/components/view/ViewProps.h>
13
+ #include <react/renderer/core/PropsParserContext.h>
14
+ #include <vector>
15
+
16
+ namespace facebook {
17
+ namespace react {
18
+ enum class RNCWebViewAndroidLayerType {
19
+ None,
20
+ Software,
21
+ Hardware
22
+ };
23
+ static RNCWebViewAndroidLayerType parseAndroidLayerType(const std::string& string)
24
+ {
25
+ if (string == "none") {
26
+ return RNCWebViewAndroidLayerType::None;
27
+ }
28
+ if (string == "software") {
29
+ return RNCWebViewAndroidLayerType::Software;
30
+ }
31
+ if (string == "hardware") {
32
+ return RNCWebViewAndroidLayerType::Hardware;
33
+ }
34
+ throw std::runtime_error("Unexpected value for RNCWebViewAndroidLayerType: " + string);
35
+ }
36
+ static inline void fromRawValue(const PropsParserContext &context, const RawValue &value,
37
+ RNCWebViewAndroidLayerType &result)
38
+ {
39
+ auto string = (std::string)value;
40
+ result = parseAndroidLayerType(string);
41
+ }
42
+
43
+ static inline std::string toString(const RNCWebViewAndroidLayerType &value)
44
+ {
45
+ switch (value) {
46
+ case RNCWebViewAndroidLayerType::None:
47
+ return "none";
48
+ case RNCWebViewAndroidLayerType::Software:
49
+ return "software";
50
+ case RNCWebViewAndroidLayerType::Hardware:
51
+ return "hardware";
52
+ }
53
+ }
54
+ enum class RNCWebViewCacheMode {
55
+ LOAD_DEFAULT,
56
+ LOAD_CACHE_ELSE_NETWORK,
57
+ LOAD_NO_CACHE,
58
+ LOAD_CACHE_ONLY
59
+ };
60
+ static RNCWebViewCacheMode parseCacheMode(const std::string& string)
61
+ {
62
+ if (string == "LOAD_DEFAULT") {
63
+ return RNCWebViewCacheMode::LOAD_DEFAULT;
64
+ }
65
+ if (string == "LOAD_CACHE_ELSE_NETWORK") {
66
+ return RNCWebViewCacheMode::LOAD_CACHE_ELSE_NETWORK;
67
+ }
68
+ if (string == "LOAD_NO_CACHE") {
69
+ return RNCWebViewCacheMode::LOAD_NO_CACHE;
70
+ }
71
+ if (string == "LOAD_CACHE_ONLY") {
72
+ return RNCWebViewCacheMode::LOAD_CACHE_ONLY;
73
+ }
74
+ throw std::runtime_error("Unexpected value for RNCWebViewCacheMode: " + string);
75
+ }
76
+ static inline void fromRawValue(const PropsParserContext &context, const RawValue &value,
77
+ RNCWebViewCacheMode &result)
78
+ {
79
+ auto string = (std::string)value;
80
+ result = parseCacheMode(string);
81
+ }
82
+ static inline std::string toString(const RNCWebViewCacheMode &value)
83
+ {
84
+ switch (value) {
85
+ case RNCWebViewCacheMode::LOAD_DEFAULT: return "LOAD_DEFAULT";
86
+ case RNCWebViewCacheMode::LOAD_CACHE_ELSE_NETWORK: return "LOAD_CACHE_ELSE_NETWORK";
87
+ case RNCWebViewCacheMode::LOAD_NO_CACHE: return "LOAD_NO_CACHE";
88
+ case RNCWebViewCacheMode::LOAD_CACHE_ONLY: return "LOAD_CACHE_ONLY";
89
+ }
90
+ }
91
+ enum class RNCWebViewMixedContentMode {
92
+ Never,
93
+ Always,
94
+ Compatibility
95
+ };
96
+ static RNCWebViewMixedContentMode parseMixedContentMode(const std::string& string)
97
+ {
98
+ if (string == "never") {
99
+ return RNCWebViewMixedContentMode::Never;
100
+ }
101
+ if (string == "always") {
102
+ return RNCWebViewMixedContentMode::Always;
103
+ }
104
+ if (string == "compatibility") {
105
+ return RNCWebViewMixedContentMode::Compatibility;
106
+ }
107
+ throw std::runtime_error("Unexpected value for RNCWebViewMixedContentMode: " + string);
108
+ }
109
+ static inline void fromRawValue(const PropsParserContext &context, const RawValue &value,
110
+ RNCWebViewMixedContentMode &result)
111
+ {
112
+ auto string = (std::string)value;
113
+ result = parseMixedContentMode(string);
114
+ }
115
+
116
+ static inline std::string toString(const RNCWebViewMixedContentMode &value)
117
+ {
118
+ switch (value) {
119
+ case RNCWebViewMixedContentMode::Never:
120
+ return "never";
121
+ case RNCWebViewMixedContentMode::Always:
122
+ return "always";
123
+ case RNCWebViewMixedContentMode::Compatibility:
124
+ return "compatibility";
125
+ }
126
+ }
127
+ enum class RNCWebViewContentInsetAdjustmentBehavior {
128
+ Never,
129
+ Automatic,
130
+ ScrollableAxes,
131
+ Always
132
+ };
133
+ static RNCWebViewContentInsetAdjustmentBehavior parseBehavior(const std::string& string)
134
+ {
135
+ if (string == "never") {
136
+ return RNCWebViewContentInsetAdjustmentBehavior::Never;
137
+ }
138
+ if (string == "automatic") {
139
+ return RNCWebViewContentInsetAdjustmentBehavior::Automatic;
140
+ }
141
+ if (string == "scrollableAxes") {
142
+ return RNCWebViewContentInsetAdjustmentBehavior::ScrollableAxes;
143
+ }
144
+ if (string == "always") {
145
+ return RNCWebViewContentInsetAdjustmentBehavior::Always;
146
+ }
147
+ throw std::runtime_error("Unexpected value for RNCWebViewContentInsetAdjustmentBehavior: " + string);
148
+ }
149
+ static inline void fromRawValue(const PropsParserContext &context, const RawValue &value,
150
+ RNCWebViewContentInsetAdjustmentBehavior &result)
151
+ {
152
+ auto string = (std::string)value;
153
+ result = parseBehavior(string);
154
+ }
155
+ static inline std::string toString(const RNCWebViewContentInsetAdjustmentBehavior &value)
156
+ {
157
+ switch (value) {
158
+ case RNCWebViewContentInsetAdjustmentBehavior::Never:
159
+ return "never";
160
+ case RNCWebViewContentInsetAdjustmentBehavior::Automatic:
161
+ return "automatic";
162
+ case RNCWebViewContentInsetAdjustmentBehavior::ScrollableAxes:
163
+ return "scrollableAxes";
164
+ case RNCWebViewContentInsetAdjustmentBehavior::Always:
165
+ return "always";
166
+ }
167
+ }
168
+ enum class RNCWebViewContentMode {
169
+ Recommended,
170
+ Mobile,
171
+ Desktop
172
+ };
173
+ static RNCWebViewContentMode parseContentMode(const std::string& string)
174
+ {
175
+ if (string == "recommended") {
176
+ return RNCWebViewContentMode::Recommended;
177
+ }
178
+ if (string == "mobile") {
179
+ return RNCWebViewContentMode::Mobile;
180
+ }
181
+ if (string == "desktop") {
182
+ return RNCWebViewContentMode::Desktop;
183
+ }
184
+ throw std::runtime_error("Unexpected value for RNCWebViewContentMode: " + string);
185
+ }
186
+ static inline void fromRawValue(const PropsParserContext &context, const RawValue &value,
187
+ RNCWebViewContentMode &result)
188
+ {
189
+ auto string = (std::string)value;
190
+ result = parseContentMode(string);
191
+ }
192
+ static inline std::string toString(const RNCWebViewContentMode &value)
193
+ {
194
+ switch (value) {
195
+ case RNCWebViewContentMode::Recommended:
196
+ return "recommended";
197
+ case RNCWebViewContentMode::Mobile:
198
+ return "mobile";
199
+ case RNCWebViewContentMode::Desktop:
200
+ return "desktop";
201
+ }
202
+ }
203
+ enum class RNCWebViewMediaCapturePermissionGrantType {
204
+ Prompt,
205
+ Grant,
206
+ Deny,
207
+ GrantIfSameHostElsePrompt,
208
+ GrantIfSameHostElseDeny
209
+ };
210
+ static RNCWebViewMediaCapturePermissionGrantType parseMCPGType(const std::string& string)
211
+ {
212
+ if (string == "prompt") {
213
+ return RNCWebViewMediaCapturePermissionGrantType::Prompt;
214
+ }
215
+ if (string == "grant") {
216
+ return RNCWebViewMediaCapturePermissionGrantType::Grant;
217
+ }
218
+ if (string == "deny") {
219
+ return RNCWebViewMediaCapturePermissionGrantType::Deny;
220
+ }
221
+ if (string == "grantIfSameHostElsePrompt") {
222
+ return RNCWebViewMediaCapturePermissionGrantType::GrantIfSameHostElsePrompt;
223
+ }
224
+ if (string == "grantIfSameHostElseDeny") {
225
+ return RNCWebViewMediaCapturePermissionGrantType::GrantIfSameHostElseDeny;
226
+ }
227
+ throw std::runtime_error("Unexpected value for RNCWebViewMediaCapturePermissionGrantType: " + string);
228
+ }
229
+ static inline void fromRawValue(const PropsParserContext &context, const RawValue &value,
230
+ RNCWebViewMediaCapturePermissionGrantType &result)
231
+ {
232
+ auto string = (std::string)value;
233
+ result = parseMCPGType(string);
234
+ }
235
+ static inline std::string toString(const RNCWebViewMediaCapturePermissionGrantType &value)
236
+ {
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:
242
+ return "grantIfSameHostElsePrompt";
243
+ case RNCWebViewMediaCapturePermissionGrantType::GrantIfSameHostElseDeny:
244
+ return "grantIfSameHostElseDeny";
245
+ }
246
+ }
247
+
248
+ class RNCWebViewProps final : public ViewProps {
249
+ public:
250
+ RNCWebViewProps() = default;
251
+ RNCWebViewProps(const PropsParserContext &context, const RNCWebViewProps &sourceProps,
252
+ const RawProps &rawProps);
253
+
254
+ #pragma mark - Props
255
+
256
+ bool allowFileAccess{false};
257
+ bool allowsProtectedMedia{false};
258
+ bool allowsFullscreenVideo{false};
259
+ RNCWebViewAndroidLayerType androidLayerType{RNCWebViewAndroidLayerType::None};
260
+ RNCWebViewCacheMode cacheMode{RNCWebViewCacheMode::LOAD_DEFAULT};
261
+ bool domStorageEnabled{false};
262
+ std::string downloadingMessage{};
263
+ bool forceDarkOn{false};
264
+ bool geolocationEnabled{false};
265
+ std::string lackPermissionToDownloadMessage{};
266
+ std::string messagingModuleName{};
267
+ int minimumFontSize{0};
268
+ RNCWebViewMixedContentMode mixedContentMode{RNCWebViewMixedContentMode::Never};
269
+ bool nestedScrollEnabled{false};
270
+ std::string overScrollMode{};
271
+ bool saveFormDataDisabled{false};
272
+ bool scalesPageToFit{false};
273
+ bool setBuiltInZoomControls{false};
274
+ bool setDisplayZoomControls{false};
275
+ bool setSupportMultipleWindows{false};
276
+ int textZoom{0};
277
+ bool thirdPartyCookiesEnabled{false};
278
+ bool hasOnScroll{false};
279
+ std::string injectedJavaScriptObject{};
280
+ std::string allowingReadAccessToURL{};
281
+ bool allowsBackForwardNavigationGestures{false};
282
+ bool allowsInlineMediaPlayback{false};
283
+ bool allowsAirPlayForMediaPlayback{false};
284
+ bool allowsLinkPreview{false};
285
+ bool automaticallyAdjustContentInsets{false};
286
+ bool ignoreSilentHardwareSwitch{false};
287
+ bool autoManageStatusBarEnabled{false};
288
+ bool bounces{false};
289
+ folly::dynamic contentInset{};
290
+ RNCWebViewContentInsetAdjustmentBehavior contentInsetAdjustmentBehavior{
291
+ RNCWebViewContentInsetAdjustmentBehavior::Never};
292
+ RNCWebViewContentMode contentMode{RNCWebViewContentMode::Recommended};
293
+ folly::dynamic dataDetectorTypes{};
294
+ double decelerationRate{0.0};
295
+ bool directionalLockEnabled{false};
296
+ bool enableApplePay{false};
297
+ bool hideKeyboardAccessoryView{false};
298
+ bool keyboardDisplayRequiresUserAction{false};
299
+ bool limitsNavigationsToAppBoundDomains{false};
300
+ RNCWebViewMediaCapturePermissionGrantType mediaCapturePermissionGrantType{
301
+ RNCWebViewMediaCapturePermissionGrantType::Prompt};
302
+ bool pagingEnabled{false};
303
+ bool pullToRefreshEnabled{false};
304
+ bool scrollEnabled{false};
305
+ bool sharedCookiesEnabled{false};
306
+ bool textInteractionEnabled{false};
307
+ bool useSharedProcessPool{false};
308
+ folly::dynamic menuItems{};
309
+ std::vector<folly::dynamic> suppressMenuItems{};
310
+ bool hasOnFileDownload{false};
311
+ bool fraudulentWebsiteWarningEnabled{false};
312
+ bool allowFileAccessFromFileURLs{false};
313
+ bool allowUniversalAccessFromFileURLs{false};
314
+ std::string applicationNameForUserAgent{};
315
+ folly::dynamic basicAuthCredential{};
316
+ bool cacheEnabled{false};
317
+ bool incognito{false};
318
+ std::string injectedJavaScript{};
319
+ std::string injectedJavaScriptBeforeContentLoaded{};
320
+ bool injectedJavaScriptForMainFrameOnly{false};
321
+ bool injectedJavaScriptBeforeContentLoadedForMainFrameOnly{false};
322
+ bool javaScriptCanOpenWindowsAutomatically{false};
323
+ bool javaScriptEnabled{false};
324
+ bool hasOnShouldStartLoadWithRequestEvent{false};
325
+ folly::dynamic originWhitelist{};
326
+ bool webviewDebuggingEnabled{false};
327
+ bool mediaPlaybackRequiresUserAction{false};
328
+ bool messagingEnabled{false};
329
+ bool shouldStartLoadWithRequestEnabled{false};
330
+ bool hasOnOpenWindowEvent{false};
331
+ bool showsHorizontalScrollIndicator{false};
332
+ bool showsVerticalScrollIndicator{false};
333
+ folly::dynamic newSource{};
334
+ std::string userAgent{};
335
+ folly::dynamic schemeList{};
336
+ std::string renderMode{};
337
+ };
338
+
339
+ } // namespace react
340
+ } // namespace facebook