@react-native-ohos/react-native-webview 13.10.5-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.md +13 -0
- package/harmony/rn_webview/BuildProfile.ets +41 -0
- package/harmony/rn_webview/LICENSE +21 -0
- package/harmony/rn_webview/NOTICE +33 -0
- package/harmony/rn_webview/OAT.xml +45 -0
- package/harmony/rn_webview/README.OpenSource +11 -0
- package/harmony/rn_webview/build-profile.json5 +28 -0
- package/harmony/rn_webview/consumer-rules.txt +0 -0
- package/harmony/rn_webview/hvigorfile.ts +1 -0
- package/harmony/rn_webview/index.ets +34 -0
- package/harmony/rn_webview/obfuscation-rules.txt +18 -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 +37 -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 +126 -0
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebView.cpp +20 -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 +19 -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 +22 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/EventEmitters.cpp +240 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/EventEmitters.h +285 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/Props.cpp +151 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/Props.h +337 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ShadowNodes.cpp +19 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ShadowNodes.h +34 -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 +20 -0
- package/harmony/rn_webview/src/main/ets/CutomReference.ts +50 -0
- package/harmony/rn_webview/src/main/ets/Logger.ts +64 -0
- package/harmony/rn_webview/src/main/ets/Magic.ets +205 -0
- package/harmony/rn_webview/src/main/ets/RNCWebView.ets +607 -0
- package/harmony/rn_webview/src/main/ets/RNCWebViewPackage.ets +66 -0
- package/harmony/rn_webview/src/main/ets/ShouldRequestUrl.ts +68 -0
- package/harmony/rn_webview/src/main/ets/WebViewBaseOperate.ets +463 -0
- package/harmony/rn_webview/src/main/ets/WebViewTurboModule.ets +78 -0
- package/harmony/rn_webview/src/main/ets/generated/components/RNCWebView.ts +509 -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 +29 -0
- package/harmony/rn_webview.har +0 -0
- package/package.json +107 -0
- package/src/NativeRNCWebView.ts +16 -0
- package/src/NativeRNCWebViewModule.ts +17 -0
- package/src/RNCWebViewNativeComponent.ts +286 -0
- package/src/WebView.harmony.tsx +330 -0
- package/src/WebView.tsx +4 -0
- package/src/codegenUtils.ts +9 -0
- package/src/index.ts +4 -0
|
@@ -0,0 +1,151 @@
|
|
|
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: GeneratePropsCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include <react/renderer/components/react_native_webview/Props.h>
|
|
12
|
+
#include <folly/dynamic.h>
|
|
13
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
14
|
+
#include <react/renderer/core/propsConversions.h>
|
|
15
|
+
|
|
16
|
+
namespace facebook {
|
|
17
|
+
namespace react {
|
|
18
|
+
|
|
19
|
+
RNCWebViewProps::RNCWebViewProps(
|
|
20
|
+
const PropsParserContext &context,
|
|
21
|
+
const RNCWebViewProps &sourceProps,
|
|
22
|
+
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
|
|
23
|
+
|
|
24
|
+
allowFileAccess(convertRawProp(context, rawProps, "allowFileAccess", sourceProps.allowFileAccess, {false})),
|
|
25
|
+
allowsProtectedMedia(convertRawProp(context, rawProps, "allowsProtectedMedia",
|
|
26
|
+
sourceProps.allowsProtectedMedia, {false})),
|
|
27
|
+
allowsFullscreenVideo(convertRawProp(context, rawProps, "allowsFullscreenVideo",
|
|
28
|
+
sourceProps.allowsFullscreenVideo, {false})),
|
|
29
|
+
androidLayerType(convertRawProp(context, rawProps, "androidLayerType",
|
|
30
|
+
sourceProps.androidLayerType, {RNCWebViewAndroidLayerType::None})),
|
|
31
|
+
cacheMode(convertRawProp(context, rawProps, "cacheMode", sourceProps.cacheMode,
|
|
32
|
+
{RNCWebViewCacheMode::LOAD_DEFAULT})),
|
|
33
|
+
domStorageEnabled(convertRawProp(context, rawProps, "domStorageEnabled", sourceProps.domStorageEnabled, {false})),
|
|
34
|
+
downloadingMessage(convertRawProp(context, rawProps, "downloadingMessage", sourceProps.downloadingMessage, {})),
|
|
35
|
+
forceDarkOn(convertRawProp(context, rawProps, "forceDarkOn", sourceProps.forceDarkOn, {false})),
|
|
36
|
+
geolocationEnabled(convertRawProp(context, rawProps, "geolocationEnabled",
|
|
37
|
+
sourceProps.geolocationEnabled, {false})),
|
|
38
|
+
lackPermissionToDownloadMessage(convertRawProp(context, rawProps, "lackPermissionToDownloadMessage",
|
|
39
|
+
sourceProps.lackPermissionToDownloadMessage, {})),
|
|
40
|
+
messagingModuleName(convertRawProp(context, rawProps, "messagingModuleName", sourceProps.messagingModuleName, {})),
|
|
41
|
+
minimumFontSize(convertRawProp(context, rawProps, "minimumFontSize", sourceProps.minimumFontSize, {0})),
|
|
42
|
+
mixedContentMode(convertRawProp(context, rawProps, "mixedContentMode", sourceProps.mixedContentMode,
|
|
43
|
+
{RNCWebViewMixedContentMode::Never})),
|
|
44
|
+
nestedScrollEnabled(convertRawProp(context, rawProps, "nestedScrollEnabled",
|
|
45
|
+
sourceProps.nestedScrollEnabled, {false})),
|
|
46
|
+
overScrollMode(convertRawProp(context, rawProps, "overScrollMode", sourceProps.overScrollMode, {})),
|
|
47
|
+
saveFormDataDisabled(convertRawProp(context, rawProps, "saveFormDataDisabled",
|
|
48
|
+
sourceProps.saveFormDataDisabled, {false})),
|
|
49
|
+
scalesPageToFit(convertRawProp(context, rawProps, "scalesPageToFit", sourceProps.scalesPageToFit, {false})),
|
|
50
|
+
setBuiltInZoomControls(convertRawProp(context, rawProps, "setBuiltInZoomControls",
|
|
51
|
+
sourceProps.setBuiltInZoomControls, {false})),
|
|
52
|
+
setDisplayZoomControls(convertRawProp(context, rawProps, "setDisplayZoomControls",
|
|
53
|
+
sourceProps.setDisplayZoomControls, {false})),
|
|
54
|
+
setSupportMultipleWindows(convertRawProp(context, rawProps, "setSupportMultipleWindows",
|
|
55
|
+
sourceProps.setSupportMultipleWindows, {false})),
|
|
56
|
+
textZoom(convertRawProp(context, rawProps, "textZoom", sourceProps.textZoom, {0})),
|
|
57
|
+
thirdPartyCookiesEnabled(convertRawProp(context, rawProps, "thirdPartyCookiesEnabled",
|
|
58
|
+
sourceProps.thirdPartyCookiesEnabled, {false})),
|
|
59
|
+
hasOnScroll(convertRawProp(context, rawProps, "hasOnScroll", sourceProps.hasOnScroll, {false})),
|
|
60
|
+
injectedJavaScriptObject(convertRawProp(context, rawProps, "injectedJavaScriptObject",
|
|
61
|
+
sourceProps.injectedJavaScriptObject, {})),
|
|
62
|
+
allowingReadAccessToURL(convertRawProp(context, rawProps, "allowingReadAccessToURL",
|
|
63
|
+
sourceProps.allowingReadAccessToURL, {})),
|
|
64
|
+
allowsBackForwardNavigationGestures(convertRawProp(context, rawProps, "allowsBackForwardNavigationGestures",
|
|
65
|
+
sourceProps.allowsBackForwardNavigationGestures, {false})),
|
|
66
|
+
allowsInlineMediaPlayback(convertRawProp(context, rawProps, "allowsInlineMediaPlayback",
|
|
67
|
+
sourceProps.allowsInlineMediaPlayback, {false})),
|
|
68
|
+
allowsAirPlayForMediaPlayback(convertRawProp(context, rawProps, "allowsAirPlayForMediaPlayback",
|
|
69
|
+
sourceProps.allowsAirPlayForMediaPlayback, {false})),
|
|
70
|
+
allowsLinkPreview(convertRawProp(context, rawProps, "allowsLinkPreview",
|
|
71
|
+
sourceProps.allowsLinkPreview, {false})),
|
|
72
|
+
automaticallyAdjustContentInsets(convertRawProp(context, rawProps, "automaticallyAdjustContentInsets",
|
|
73
|
+
sourceProps.automaticallyAdjustContentInsets, {false})),
|
|
74
|
+
ignoreSilentHardwareSwitch(convertRawProp(context, rawProps, "ignoreSilentHardwareSwitch",
|
|
75
|
+
sourceProps.ignoreSilentHardwareSwitch, {false})),
|
|
76
|
+
autoManageStatusBarEnabled(convertRawProp(context, rawProps, "autoManageStatusBarEnabled",
|
|
77
|
+
sourceProps.autoManageStatusBarEnabled, {false})),
|
|
78
|
+
bounces(convertRawProp(context, rawProps, "bounces", sourceProps.bounces, {false})),
|
|
79
|
+
contentInset(convertRawProp(context, rawProps, "contentInset", sourceProps.contentInset, {})),
|
|
80
|
+
contentInsetAdjustmentBehavior(convertRawProp(context, rawProps, "contentInsetAdjustmentBehavior",
|
|
81
|
+
sourceProps.contentInsetAdjustmentBehavior, {RNCWebViewContentInsetAdjustmentBehavior::Never})),
|
|
82
|
+
contentMode(convertRawProp(context, rawProps, "contentMode", sourceProps.contentMode,
|
|
83
|
+
{RNCWebViewContentMode::Recommended})),
|
|
84
|
+
dataDetectorTypes(convertRawProp(context, rawProps, "dataDetectorTypes", sourceProps.dataDetectorTypes, {})),
|
|
85
|
+
decelerationRate(convertRawProp(context, rawProps, "decelerationRate", sourceProps.decelerationRate, {0.0})),
|
|
86
|
+
directionalLockEnabled(convertRawProp(context, rawProps, "directionalLockEnabled",
|
|
87
|
+
sourceProps.directionalLockEnabled, {false})),
|
|
88
|
+
enableApplePay(convertRawProp(context, rawProps, "enableApplePay", sourceProps.enableApplePay, {false})),
|
|
89
|
+
hideKeyboardAccessoryView(convertRawProp(context, rawProps, "hideKeyboardAccessoryView",
|
|
90
|
+
sourceProps.hideKeyboardAccessoryView, {false})),
|
|
91
|
+
keyboardDisplayRequiresUserAction(convertRawProp(context, rawProps, "keyboardDisplayRequiresUserAction",
|
|
92
|
+
sourceProps.keyboardDisplayRequiresUserAction, {false})),
|
|
93
|
+
limitsNavigationsToAppBoundDomains(convertRawProp(context, rawProps, "limitsNavigationsToAppBoundDomains",
|
|
94
|
+
sourceProps.limitsNavigationsToAppBoundDomains, {false})),
|
|
95
|
+
mediaCapturePermissionGrantType(convertRawProp(context, rawProps, "mediaCapturePermissionGrantType",
|
|
96
|
+
sourceProps.mediaCapturePermissionGrantType, {RNCWebViewMediaCapturePermissionGrantType::Prompt})),
|
|
97
|
+
pagingEnabled(convertRawProp(context, rawProps, "pagingEnabled", sourceProps.pagingEnabled, {false})),
|
|
98
|
+
pullToRefreshEnabled(convertRawProp(context, rawProps, "pullToRefreshEnabled",
|
|
99
|
+
sourceProps.pullToRefreshEnabled, {false})),
|
|
100
|
+
scrollEnabled(convertRawProp(context, rawProps, "scrollEnabled", sourceProps.scrollEnabled, {false})),
|
|
101
|
+
sharedCookiesEnabled(convertRawProp(context, rawProps, "sharedCookiesEnabled",
|
|
102
|
+
sourceProps.sharedCookiesEnabled, {false})),
|
|
103
|
+
textInteractionEnabled(convertRawProp(context, rawProps, "textInteractionEnabled",
|
|
104
|
+
sourceProps.textInteractionEnabled, {false})),
|
|
105
|
+
useSharedProcessPool(convertRawProp(context, rawProps, "useSharedProcessPool",
|
|
106
|
+
sourceProps.useSharedProcessPool, {false})),
|
|
107
|
+
menuItems(convertRawProp(context, rawProps, "menuItems", sourceProps.menuItems, {})),
|
|
108
|
+
suppressMenuItems(convertRawProp(context, rawProps, "suppressMenuItems", sourceProps.suppressMenuItems, {})),
|
|
109
|
+
hasOnFileDownload(convertRawProp(context, rawProps, "hasOnFileDownload", sourceProps.hasOnFileDownload, {false})),
|
|
110
|
+
fraudulentWebsiteWarningEnabled(convertRawProp(context, rawProps, "fraudulentWebsiteWarningEnabled",
|
|
111
|
+
sourceProps.fraudulentWebsiteWarningEnabled, {false})),
|
|
112
|
+
allowFileAccessFromFileURLs(convertRawProp(context, rawProps, "allowFileAccessFromFileURLs",
|
|
113
|
+
sourceProps.allowFileAccessFromFileURLs, {false})),
|
|
114
|
+
allowUniversalAccessFromFileURLs(convertRawProp(context, rawProps, "allowUniversalAccessFromFileURLs",
|
|
115
|
+
sourceProps.allowUniversalAccessFromFileURLs, {false})),
|
|
116
|
+
applicationNameForUserAgent(convertRawProp(context, rawProps, "applicationNameForUserAgent",
|
|
117
|
+
sourceProps.applicationNameForUserAgent, {})),
|
|
118
|
+
basicAuthCredential(convertRawProp(context, rawProps, "basicAuthCredential", sourceProps.basicAuthCredential, {})),
|
|
119
|
+
cacheEnabled(convertRawProp(context, rawProps, "cacheEnabled", sourceProps.cacheEnabled, {false})),
|
|
120
|
+
incognito(convertRawProp(context, rawProps, "incognito", sourceProps.incognito, {false})),
|
|
121
|
+
injectedJavaScript(convertRawProp(context, rawProps, "injectedJavaScript", sourceProps.injectedJavaScript, {})),
|
|
122
|
+
injectedJavaScriptBeforeContentLoaded(convertRawProp(context, rawProps, "injectedJavaScriptBeforeContentLoaded",
|
|
123
|
+
sourceProps.injectedJavaScriptBeforeContentLoaded, {})),
|
|
124
|
+
injectedJavaScriptForMainFrameOnly(convertRawProp(context, rawProps, "injectedJavaScriptForMainFrameOnly",
|
|
125
|
+
sourceProps.injectedJavaScriptForMainFrameOnly, {false})),
|
|
126
|
+
injectedJavaScriptBeforeContentLoadedForMainFrameOnly(convertRawProp(context, rawProps,
|
|
127
|
+
"injectedJavaScriptBeforeContentLoadedForMainFrameOnly",
|
|
128
|
+
sourceProps.injectedJavaScriptBeforeContentLoadedForMainFrameOnly, {false})),
|
|
129
|
+
javaScriptCanOpenWindowsAutomatically(convertRawProp(context, rawProps, "javaScriptCanOpenWindowsAutomatically",
|
|
130
|
+
sourceProps.javaScriptCanOpenWindowsAutomatically, {false})),
|
|
131
|
+
javaScriptEnabled(convertRawProp(context, rawProps, "javaScriptEnabled", sourceProps.javaScriptEnabled, {false})),
|
|
132
|
+
webviewDebuggingEnabled(convertRawProp(context, rawProps, "webviewDebuggingEnabled",
|
|
133
|
+
sourceProps.webviewDebuggingEnabled, {false})),
|
|
134
|
+
mediaPlaybackRequiresUserAction(convertRawProp(context, rawProps, "mediaPlaybackRequiresUserAction",
|
|
135
|
+
sourceProps.mediaPlaybackRequiresUserAction, {false})),
|
|
136
|
+
messagingEnabled(convertRawProp(context, rawProps, "messagingEnabled", sourceProps.messagingEnabled, {false})),
|
|
137
|
+
shouldStartLoadWithRequestEnabled(convertRawProp(context, rawProps, "shouldStartLoadWithRequestEnabled",
|
|
138
|
+
sourceProps.shouldStartLoadWithRequestEnabled, {false})),
|
|
139
|
+
hasOnOpenWindowEvent(convertRawProp(context, rawProps, "hasOnOpenWindowEvent",
|
|
140
|
+
sourceProps.hasOnOpenWindowEvent, {false})),
|
|
141
|
+
showsHorizontalScrollIndicator(convertRawProp(context, rawProps, "showsHorizontalScrollIndicator",
|
|
142
|
+
sourceProps.showsHorizontalScrollIndicator, {false})),
|
|
143
|
+
showsVerticalScrollIndicator(convertRawProp(context, rawProps, "showsVerticalScrollIndicator",
|
|
144
|
+
sourceProps.showsVerticalScrollIndicator, {false})),
|
|
145
|
+
newSource(convertRawProp(context, rawProps, "newSource", sourceProps.newSource, {})),
|
|
146
|
+
userAgent(convertRawProp(context, rawProps, "userAgent", sourceProps.userAgent, {})),
|
|
147
|
+
schemeList(convertRawProp(context, rawProps, "schemeList", sourceProps.schemeList, {}))
|
|
148
|
+
{}
|
|
149
|
+
|
|
150
|
+
} // namespace react
|
|
151
|
+
} // namespace facebook
|
|
@@ -0,0 +1,337 @@
|
|
|
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 webviewDebuggingEnabled{false};
|
|
325
|
+
bool mediaPlaybackRequiresUserAction{false};
|
|
326
|
+
bool messagingEnabled{false};
|
|
327
|
+
bool shouldStartLoadWithRequestEnabled{false};
|
|
328
|
+
bool hasOnOpenWindowEvent{false};
|
|
329
|
+
bool showsHorizontalScrollIndicator{false};
|
|
330
|
+
bool showsVerticalScrollIndicator{false};
|
|
331
|
+
folly::dynamic newSource{};
|
|
332
|
+
std::string userAgent{};
|
|
333
|
+
folly::dynamic schemeList{};
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
} // namespace react
|
|
337
|
+
} // namespace facebook
|
|
@@ -0,0 +1,19 @@
|
|
|
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 <react/renderer/components/react_native_webview/ShadowNodes.h>
|
|
12
|
+
|
|
13
|
+
namespace facebook {
|
|
14
|
+
namespace react {
|
|
15
|
+
|
|
16
|
+
const char RNC_WEB_VIEW_COMPONENT_NAME[] = "RNCWebView";
|
|
17
|
+
|
|
18
|
+
} // namespace react
|
|
19
|
+
} // namespace facebook
|
|
@@ -0,0 +1,34 @@
|
|
|
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 <react/renderer/components/react_native_webview/EventEmitters.h>
|
|
14
|
+
#include <react/renderer/components/react_native_webview/Props.h>
|
|
15
|
+
#include <react/renderer/components/react_native_webview/States.h>
|
|
16
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
17
|
+
#include <jsi/jsi.h>
|
|
18
|
+
|
|
19
|
+
namespace facebook {
|
|
20
|
+
namespace react {
|
|
21
|
+
|
|
22
|
+
JSI_EXPORT extern const char RNC_WEB_VIEW_COMPONENT_NAME[32];
|
|
23
|
+
|
|
24
|
+
/*
|
|
25
|
+
* `ShadowNode` for <RNCWebView> component.
|
|
26
|
+
*/
|
|
27
|
+
using RNCWebViewShadowNode = ConcreteViewShadowNode<
|
|
28
|
+
RNC_WEB_VIEW_COMPONENT_NAME,
|
|
29
|
+
RNCWebViewProps,
|
|
30
|
+
RNCWebViewEventEmitter,
|
|
31
|
+
RNCWebViewState>;
|
|
32
|
+
|
|
33
|
+
} // namespace react
|
|
34
|
+
} // namespace facebook
|
|
@@ -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 <react/renderer/components/react_native_webview/States.h>
|
|
11
|
+
|
|
12
|
+
namespace facebook {
|
|
13
|
+
namespace react {
|
|
14
|
+
|
|
15
|
+
} // namespace react
|
|
16
|
+
} // namespace facebook
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
namespace facebook {
|
|
12
|
+
namespace react {
|
|
13
|
+
|
|
14
|
+
class RNCWebViewState {
|
|
15
|
+
public:
|
|
16
|
+
RNCWebViewState() = default;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
} // namespace react
|
|
20
|
+
} // namespace facebook
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export class CustomReference {
|
|
26
|
+
private atomicValue: number;
|
|
27
|
+
private callBack!: Function;
|
|
28
|
+
constructor(init: number) {
|
|
29
|
+
this.atomicValue = init
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
getValue() {
|
|
33
|
+
return this.atomicValue
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
setCallBack(callBack: Function) {
|
|
37
|
+
this.callBack = callBack
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
getCallBack() {
|
|
41
|
+
return this.callBack
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
setValue(newValue: number) {
|
|
45
|
+
this.atomicValue = newValue
|
|
46
|
+
if (this.callBack) {
|
|
47
|
+
this.callBack()
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|