@react-native-ohos/react-native-webview 13.15.2-rc.1 → 13.16.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/harmony/rn_webview/oh-package.json5 +1 -1
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/BaseReactNativeWebviewPackage.h +1 -0
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/components/RNCWebViewJSIBinder.h +110 -116
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/EventEmitters.cpp +17 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/EventEmitters.h +14 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/Props.cpp +85 -90
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/Props.h +0 -2
- package/harmony/rn_webview/src/main/ets/Magic.ets +0 -1
- package/harmony/rn_webview/src/main/ets/RNCWebView.ets +7 -26
- package/harmony/rn_webview/src/main/ets/WebViewBaseOperate.ets +44 -0
- package/harmony/rn_webview/src/main/ets/generated/components/RNCWebView.ts +1 -2
- package/harmony/rn_webview.har +0 -0
- package/package.json +3 -2
- package/src/RNCWebViewNativeComponent.ts +1 -2
- package/src/WebView.harmony.tsx +9 -7
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"name": "@react-native-ohos/react-native-webview",
|
|
7
7
|
"description": "main cpai architecture",
|
|
8
8
|
"main": "index.ets",
|
|
9
|
-
"version": "13.
|
|
9
|
+
"version": "13.16.1-rc.1",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@rnoh/react-native-openharmony": "../react_native_openharmony.har"
|
|
12
12
|
}
|
package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/components/RNCWebViewJSIBinder.h
CHANGED
|
@@ -5,122 +5,116 @@
|
|
|
5
5
|
#pragma once
|
|
6
6
|
#include "RNOHCorePackage/ComponentBinders/ViewComponentJSIBinder.h"
|
|
7
7
|
|
|
8
|
-
namespace rnoh
|
|
9
|
-
{
|
|
10
|
-
|
|
11
|
-
{
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
object.setProperty(rt, "indicatorStyle", true);
|
|
95
|
-
object.setProperty(rt, "newSource", "Object");
|
|
96
|
-
object.setProperty(rt, "userAgent", true);
|
|
97
|
-
return object;
|
|
98
|
-
}
|
|
8
|
+
namespace rnoh {
|
|
9
|
+
class RNCWebViewJSIBinder : public ViewComponentJSIBinder {
|
|
10
|
+
protected:
|
|
11
|
+
facebook::jsi::Object createNativeProps(facebook::jsi::Runtime &rt) override {
|
|
12
|
+
auto object = ViewComponentJSIBinder::createNativeProps(rt);
|
|
13
|
+
object.setProperty(rt, "allowFileAccess", true);
|
|
14
|
+
object.setProperty(rt, "allowsProtectedMedia", true);
|
|
15
|
+
object.setProperty(rt, "allowsFullscreenVideo", true);
|
|
16
|
+
object.setProperty(rt, "androidLayerType", true);
|
|
17
|
+
object.setProperty(rt, "cacheMode", true);
|
|
18
|
+
object.setProperty(rt, "domStorageEnabled", true);
|
|
19
|
+
object.setProperty(rt, "downloadingMessage", true);
|
|
20
|
+
object.setProperty(rt, "forceDarkOn", true);
|
|
21
|
+
object.setProperty(rt, "geolocationEnabled", true);
|
|
22
|
+
object.setProperty(rt, "lackPermissionToDownloadMessage", true);
|
|
23
|
+
object.setProperty(rt, "messagingModuleName", true);
|
|
24
|
+
object.setProperty(rt, "minimumFontSize", true);
|
|
25
|
+
object.setProperty(rt, "mixedContentMode", true);
|
|
26
|
+
object.setProperty(rt, "nestedScrollEnabled", true);
|
|
27
|
+
object.setProperty(rt, "overScrollMode", true);
|
|
28
|
+
object.setProperty(rt, "saveFormDataDisabled", true);
|
|
29
|
+
object.setProperty(rt, "scalesPageToFit", true);
|
|
30
|
+
object.setProperty(rt, "setBuiltInZoomControls", true);
|
|
31
|
+
object.setProperty(rt, "setDisplayZoomControls", true);
|
|
32
|
+
object.setProperty(rt, "setSupportMultipleWindows", true);
|
|
33
|
+
object.setProperty(rt, "textZoom", true);
|
|
34
|
+
object.setProperty(rt, "thirdPartyCookiesEnabled", true);
|
|
35
|
+
object.setProperty(rt, "hasOnScroll", true);
|
|
36
|
+
object.setProperty(rt, "injectedJavaScriptObject", true);
|
|
37
|
+
object.setProperty(rt, "paymentRequestEnabled", true);
|
|
38
|
+
object.setProperty(rt, "allowingReadAccessToURL", true);
|
|
39
|
+
object.setProperty(rt, "allowsBackForwardNavigationGestures", true);
|
|
40
|
+
object.setProperty(rt, "allowsInlineMediaPlayback", true);
|
|
41
|
+
object.setProperty(rt, "allowsPictureInPictureMediaPlayback", true);
|
|
42
|
+
object.setProperty(rt, "allowsAirPlayForMediaPlayback", true);
|
|
43
|
+
object.setProperty(rt, "allowsLinkPreview", true);
|
|
44
|
+
object.setProperty(rt, "automaticallyAdjustContentInsets", true);
|
|
45
|
+
object.setProperty(rt, "ignoreSilentHardwareSwitch", true);
|
|
46
|
+
object.setProperty(rt, "autoManageStatusBarEnabled", true);
|
|
47
|
+
object.setProperty(rt, "bounces", true);
|
|
48
|
+
object.setProperty(rt, "contentInset", "Object");
|
|
49
|
+
object.setProperty(rt, "contentInsetAdjustmentBehavior", true);
|
|
50
|
+
object.setProperty(rt, "contentMode", true);
|
|
51
|
+
object.setProperty(rt, "dataDetectorTypes", true);
|
|
52
|
+
object.setProperty(rt, "decelerationRate", true);
|
|
53
|
+
object.setProperty(rt, "directionalLockEnabled", true);
|
|
54
|
+
object.setProperty(rt, "enableApplePay", true);
|
|
55
|
+
object.setProperty(rt, "hideKeyboardAccessoryView", true);
|
|
56
|
+
object.setProperty(rt, "keyboardDisplayRequiresUserAction", true);
|
|
57
|
+
object.setProperty(rt, "limitsNavigationsToAppBoundDomains", true);
|
|
58
|
+
object.setProperty(rt, "mediaCapturePermissionGrantType", true);
|
|
59
|
+
object.setProperty(rt, "pagingEnabled", true);
|
|
60
|
+
object.setProperty(rt, "pullToRefreshEnabled", true);
|
|
61
|
+
object.setProperty(rt, "refreshControlLightMode", true);
|
|
62
|
+
object.setProperty(rt, "scrollEnabled", true);
|
|
63
|
+
object.setProperty(rt, "sharedCookiesEnabled", true);
|
|
64
|
+
object.setProperty(rt, "textInteractionEnabled", true);
|
|
65
|
+
object.setProperty(rt, "useSharedProcessPool", true);
|
|
66
|
+
object.setProperty(rt, "menuItems", true);
|
|
67
|
+
object.setProperty(rt, "suppressMenuItems", true);
|
|
68
|
+
object.setProperty(rt, "hasOnFileDownload", true);
|
|
69
|
+
object.setProperty(rt, "fraudulentWebsiteWarningEnabled", true);
|
|
70
|
+
object.setProperty(rt, "allowFileAccessFromFileURLs", true);
|
|
71
|
+
object.setProperty(rt, "allowUniversalAccessFromFileURLs", true);
|
|
72
|
+
object.setProperty(rt, "applicationNameForUserAgent", true);
|
|
73
|
+
object.setProperty(rt, "basicAuthCredential", "Object");
|
|
74
|
+
object.setProperty(rt, "cacheEnabled", true);
|
|
75
|
+
object.setProperty(rt, "incognito", true);
|
|
76
|
+
object.setProperty(rt, "injectedJavaScript", true);
|
|
77
|
+
object.setProperty(rt, "injectedJavaScriptBeforeContentLoaded", true);
|
|
78
|
+
object.setProperty(rt, "injectedJavaScriptForMainFrameOnly", true);
|
|
79
|
+
object.setProperty(rt, "injectedJavaScriptBeforeContentLoadedForMainFrameOnly", true);
|
|
80
|
+
object.setProperty(rt, "javaScriptCanOpenWindowsAutomatically", true);
|
|
81
|
+
object.setProperty(rt, "javaScriptEnabled", true);
|
|
82
|
+
object.setProperty(rt, "webviewDebuggingEnabled", true);
|
|
83
|
+
object.setProperty(rt, "mediaPlaybackRequiresUserAction", true);
|
|
84
|
+
object.setProperty(rt, "messagingEnabled", true);
|
|
85
|
+
object.setProperty(rt, "shouldStartLoadWithRequestEnabled", true);
|
|
86
|
+
object.setProperty(rt, "hasOnOpenWindowEvent", true);
|
|
87
|
+
object.setProperty(rt, "showsHorizontalScrollIndicator", true);
|
|
88
|
+
object.setProperty(rt, "showsVerticalScrollIndicator", true);
|
|
89
|
+
object.setProperty(rt, "indicatorStyle", true);
|
|
90
|
+
object.setProperty(rt, "newSource", "Object");
|
|
91
|
+
object.setProperty(rt, "userAgent", true);
|
|
92
|
+
return object;
|
|
93
|
+
}
|
|
99
94
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
95
|
+
facebook::jsi::Object createBubblingEventTypes(facebook::jsi::Runtime &rt) override {
|
|
96
|
+
facebook::jsi::Object events(rt);
|
|
97
|
+
return events;
|
|
98
|
+
}
|
|
105
99
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
100
|
+
facebook::jsi::Object createDirectEventTypes(facebook::jsi::Runtime &rt) override {
|
|
101
|
+
facebook::jsi::Object events(rt);
|
|
102
|
+
events.setProperty(rt, "topContentSizeChange", createDirectEvent(rt, "onContentSizeChange"));
|
|
103
|
+
events.setProperty(rt, "topRenderProcessGone", createDirectEvent(rt, "onRenderProcessGone"));
|
|
104
|
+
events.setProperty(rt, "topContentProcessDidTerminate", createDirectEvent(rt, "onContentProcessDidTerminate"));
|
|
105
|
+
events.setProperty(rt, "topCustomMenuSelection", createDirectEvent(rt, "onCustomMenuSelection"));
|
|
106
|
+
events.setProperty(rt, "topFileDownload", createDirectEvent(rt, "onFileDownload"));
|
|
107
|
+
events.setProperty(rt, "topLoadingError", createDirectEvent(rt, "onLoadingError"));
|
|
108
|
+
events.setProperty(rt, "topLoadingSubResourceError", createDirectEvent(rt, "onLoadingSubResourceError"));
|
|
109
|
+
events.setProperty(rt, "topLoadingFinish", createDirectEvent(rt, "onLoadingFinish"));
|
|
110
|
+
events.setProperty(rt, "topLoadingProgress", createDirectEvent(rt, "onLoadingProgress"));
|
|
111
|
+
events.setProperty(rt, "topLoadingStart", createDirectEvent(rt, "onLoadingStart"));
|
|
112
|
+
events.setProperty(rt, "topHttpError", createDirectEvent(rt, "onHttpError"));
|
|
113
|
+
events.setProperty(rt, "topMessage", createDirectEvent(rt, "onMessage"));
|
|
114
|
+
events.setProperty(rt, "topOpenWindow", createDirectEvent(rt, "onOpenWindow"));
|
|
115
|
+
events.setProperty(rt, "topScroll", createDirectEvent(rt, "onScroll"));
|
|
116
|
+
events.setProperty(rt, "topShouldStartLoadWithRequest", createDirectEvent(rt, "onShouldStartLoadWithRequest"));
|
|
117
|
+
return events;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
126
120
|
} // namespace rnoh
|
|
@@ -87,6 +87,23 @@ $payload.setProperty(runtime, "description", $event.description);
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
|
|
90
|
+
void RNCWebViewEventEmitter::onLoadingSubResourceError(OnLoadingSubResourceError $event) const {
|
|
91
|
+
dispatchEvent("loadingSubResourceError", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
92
|
+
auto $payload = jsi::Object(runtime);
|
|
93
|
+
$payload.setProperty(runtime, "url", $event.url);
|
|
94
|
+
$payload.setProperty(runtime, "loading", $event.loading);
|
|
95
|
+
$payload.setProperty(runtime, "title", $event.title);
|
|
96
|
+
$payload.setProperty(runtime, "canGoBack", $event.canGoBack);
|
|
97
|
+
$payload.setProperty(runtime, "canGoForward", $event.canGoForward);
|
|
98
|
+
$payload.setProperty(runtime, "lockIdentifier", $event.lockIdentifier);
|
|
99
|
+
$payload.setProperty(runtime, "domain", $event.domain);
|
|
100
|
+
$payload.setProperty(runtime, "code", $event.code);
|
|
101
|
+
$payload.setProperty(runtime, "description", $event.description);
|
|
102
|
+
return $payload;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
90
107
|
void RNCWebViewEventEmitter::onLoadingFinish(OnLoadingFinish $event) const {
|
|
91
108
|
dispatchEvent("loadingFinish", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
92
109
|
auto $payload = jsi::Object(runtime);
|
|
@@ -61,6 +61,18 @@ class RNCWebViewEventEmitter : public ViewEventEmitter {
|
|
|
61
61
|
std::string description;
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
+
struct OnLoadingSubResourceError {
|
|
65
|
+
std::string url;
|
|
66
|
+
bool loading;
|
|
67
|
+
std::string title;
|
|
68
|
+
bool canGoBack;
|
|
69
|
+
bool canGoForward;
|
|
70
|
+
double lockIdentifier;
|
|
71
|
+
std::string domain;
|
|
72
|
+
int code;
|
|
73
|
+
std::string description;
|
|
74
|
+
};
|
|
75
|
+
|
|
64
76
|
enum class OnLoadingFinishNavigationType {
|
|
65
77
|
Click,
|
|
66
78
|
Formsubmit,
|
|
@@ -244,6 +256,8 @@ class RNCWebViewEventEmitter : public ViewEventEmitter {
|
|
|
244
256
|
|
|
245
257
|
void onLoadingError(OnLoadingError value) const;
|
|
246
258
|
|
|
259
|
+
void onLoadingSubResourceError(OnLoadingSubResourceError value) const;
|
|
260
|
+
|
|
247
261
|
void onLoadingFinish(OnLoadingFinish value) const;
|
|
248
262
|
|
|
249
263
|
void onLoadingProgress(OnLoadingProgress value) const;
|
|
@@ -12,97 +12,92 @@
|
|
|
12
12
|
#include <react/renderer/core/PropsParserContext.h>
|
|
13
13
|
#include <react/renderer/core/propsConversions.h>
|
|
14
14
|
|
|
15
|
-
namespace facebook::react
|
|
16
|
-
{
|
|
15
|
+
namespace facebook::react {
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
RNCWebViewProps::RNCWebViewProps(
|
|
18
|
+
const PropsParserContext &context,
|
|
19
|
+
const RNCWebViewProps &sourceProps,
|
|
20
|
+
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
newSource(convertRawProp(context, rawProps, "newSource", sourceProps.newSource, {})),
|
|
104
|
-
userAgent(convertRawProp(context, rawProps, "userAgent", sourceProps.userAgent, {}))
|
|
105
|
-
{
|
|
106
|
-
}
|
|
22
|
+
allowFileAccess(convertRawProp(context, rawProps, "allowFileAccess", sourceProps.allowFileAccess, {false})),
|
|
23
|
+
allowsProtectedMedia(convertRawProp(context, rawProps, "allowsProtectedMedia", sourceProps.allowsProtectedMedia, {false})),
|
|
24
|
+
allowsFullscreenVideo(convertRawProp(context, rawProps, "allowsFullscreenVideo", sourceProps.allowsFullscreenVideo, {false})),
|
|
25
|
+
androidLayerType(convertRawProp(context, rawProps, "androidLayerType", sourceProps.androidLayerType, {RNCWebViewAndroidLayerType::None})),
|
|
26
|
+
cacheMode(convertRawProp(context, rawProps, "cacheMode", sourceProps.cacheMode, {RNCWebViewCacheMode::LOAD_DEFAULT})),
|
|
27
|
+
domStorageEnabled(convertRawProp(context, rawProps, "domStorageEnabled", sourceProps.domStorageEnabled, {false})),
|
|
28
|
+
downloadingMessage(convertRawProp(context, rawProps, "downloadingMessage", sourceProps.downloadingMessage, {})),
|
|
29
|
+
forceDarkOn(convertRawProp(context, rawProps, "forceDarkOn", sourceProps.forceDarkOn, {false})),
|
|
30
|
+
geolocationEnabled(convertRawProp(context, rawProps, "geolocationEnabled", sourceProps.geolocationEnabled, {false})),
|
|
31
|
+
lackPermissionToDownloadMessage(convertRawProp(context, rawProps, "lackPermissionToDownloadMessage", sourceProps.lackPermissionToDownloadMessage, {})),
|
|
32
|
+
messagingModuleName(convertRawProp(context, rawProps, "messagingModuleName", sourceProps.messagingModuleName, {})),
|
|
33
|
+
minimumFontSize(convertRawProp(context, rawProps, "minimumFontSize", sourceProps.minimumFontSize, {0})),
|
|
34
|
+
mixedContentMode(convertRawProp(context, rawProps, "mixedContentMode", sourceProps.mixedContentMode, {RNCWebViewMixedContentMode::Never})),
|
|
35
|
+
nestedScrollEnabled(convertRawProp(context, rawProps, "nestedScrollEnabled", sourceProps.nestedScrollEnabled, {false})),
|
|
36
|
+
overScrollMode(convertRawProp(context, rawProps, "overScrollMode", sourceProps.overScrollMode, {})),
|
|
37
|
+
saveFormDataDisabled(convertRawProp(context, rawProps, "saveFormDataDisabled", sourceProps.saveFormDataDisabled, {false})),
|
|
38
|
+
scalesPageToFit(convertRawProp(context, rawProps, "scalesPageToFit", sourceProps.scalesPageToFit, {true})),
|
|
39
|
+
setBuiltInZoomControls(convertRawProp(context, rawProps, "setBuiltInZoomControls", sourceProps.setBuiltInZoomControls, {true})),
|
|
40
|
+
setDisplayZoomControls(convertRawProp(context, rawProps, "setDisplayZoomControls", sourceProps.setDisplayZoomControls, {false})),
|
|
41
|
+
setSupportMultipleWindows(convertRawProp(context, rawProps, "setSupportMultipleWindows", sourceProps.setSupportMultipleWindows, {true})),
|
|
42
|
+
textZoom(convertRawProp(context, rawProps, "textZoom", sourceProps.textZoom, {0})),
|
|
43
|
+
thirdPartyCookiesEnabled(convertRawProp(context, rawProps, "thirdPartyCookiesEnabled", sourceProps.thirdPartyCookiesEnabled, {true})),
|
|
44
|
+
hasOnScroll(convertRawProp(context, rawProps, "hasOnScroll", sourceProps.hasOnScroll, {false})),
|
|
45
|
+
injectedJavaScriptObject(convertRawProp(context, rawProps, "injectedJavaScriptObject", sourceProps.injectedJavaScriptObject, {})),
|
|
46
|
+
paymentRequestEnabled(convertRawProp(context, rawProps, "paymentRequestEnabled", sourceProps.paymentRequestEnabled, {false})),
|
|
47
|
+
allowingReadAccessToURL(convertRawProp(context, rawProps, "allowingReadAccessToURL", sourceProps.allowingReadAccessToURL, {})),
|
|
48
|
+
allowsBackForwardNavigationGestures(convertRawProp(context, rawProps, "allowsBackForwardNavigationGestures", sourceProps.allowsBackForwardNavigationGestures, {false})),
|
|
49
|
+
allowsInlineMediaPlayback(convertRawProp(context, rawProps, "allowsInlineMediaPlayback", sourceProps.allowsInlineMediaPlayback, {false})),
|
|
50
|
+
allowsPictureInPictureMediaPlayback(convertRawProp(context, rawProps, "allowsPictureInPictureMediaPlayback", sourceProps.allowsPictureInPictureMediaPlayback, {false})),
|
|
51
|
+
allowsAirPlayForMediaPlayback(convertRawProp(context, rawProps, "allowsAirPlayForMediaPlayback", sourceProps.allowsAirPlayForMediaPlayback, {false})),
|
|
52
|
+
allowsLinkPreview(convertRawProp(context, rawProps, "allowsLinkPreview", sourceProps.allowsLinkPreview, {true})),
|
|
53
|
+
automaticallyAdjustContentInsets(convertRawProp(context, rawProps, "automaticallyAdjustContentInsets", sourceProps.automaticallyAdjustContentInsets, {true})),
|
|
54
|
+
ignoreSilentHardwareSwitch(convertRawProp(context, rawProps, "ignoreSilentHardwareSwitch", sourceProps.ignoreSilentHardwareSwitch, {false})),
|
|
55
|
+
autoManageStatusBarEnabled(convertRawProp(context, rawProps, "autoManageStatusBarEnabled", sourceProps.autoManageStatusBarEnabled, {true})),
|
|
56
|
+
bounces(convertRawProp(context, rawProps, "bounces", sourceProps.bounces, {true})),
|
|
57
|
+
contentInset(convertRawProp(context, rawProps, "contentInset", sourceProps.contentInset, {})),
|
|
58
|
+
contentInsetAdjustmentBehavior(convertRawProp(context, rawProps, "contentInsetAdjustmentBehavior", sourceProps.contentInsetAdjustmentBehavior, {RNCWebViewContentInsetAdjustmentBehavior::Never})),
|
|
59
|
+
contentMode(convertRawProp(context, rawProps, "contentMode", sourceProps.contentMode, {RNCWebViewContentMode::Recommended})),
|
|
60
|
+
dataDetectorTypes(convertRawProp(context, rawProps, "dataDetectorTypes", RNCWebViewDataDetectorTypesMaskWrapped{ .value = sourceProps.dataDetectorTypes }, {static_cast<RNCWebViewDataDetectorTypesMask>(RNCWebViewDataDetectorTypes::PhoneNumber)}).value),
|
|
61
|
+
decelerationRate(convertRawProp(context, rawProps, "decelerationRate", sourceProps.decelerationRate, {0.0})),
|
|
62
|
+
directionalLockEnabled(convertRawProp(context, rawProps, "directionalLockEnabled", sourceProps.directionalLockEnabled, {true})),
|
|
63
|
+
enableApplePay(convertRawProp(context, rawProps, "enableApplePay", sourceProps.enableApplePay, {false})),
|
|
64
|
+
hideKeyboardAccessoryView(convertRawProp(context, rawProps, "hideKeyboardAccessoryView", sourceProps.hideKeyboardAccessoryView, {false})),
|
|
65
|
+
keyboardDisplayRequiresUserAction(convertRawProp(context, rawProps, "keyboardDisplayRequiresUserAction", sourceProps.keyboardDisplayRequiresUserAction, {true})),
|
|
66
|
+
limitsNavigationsToAppBoundDomains(convertRawProp(context, rawProps, "limitsNavigationsToAppBoundDomains", sourceProps.limitsNavigationsToAppBoundDomains, {false})),
|
|
67
|
+
mediaCapturePermissionGrantType(convertRawProp(context, rawProps, "mediaCapturePermissionGrantType", sourceProps.mediaCapturePermissionGrantType, {RNCWebViewMediaCapturePermissionGrantType::Prompt})),
|
|
68
|
+
pagingEnabled(convertRawProp(context, rawProps, "pagingEnabled", sourceProps.pagingEnabled, {false})),
|
|
69
|
+
pullToRefreshEnabled(convertRawProp(context, rawProps, "pullToRefreshEnabled", sourceProps.pullToRefreshEnabled, {false})),
|
|
70
|
+
refreshControlLightMode(convertRawProp(context, rawProps, "refreshControlLightMode", sourceProps.refreshControlLightMode, {false})),
|
|
71
|
+
scrollEnabled(convertRawProp(context, rawProps, "scrollEnabled", sourceProps.scrollEnabled, {true})),
|
|
72
|
+
sharedCookiesEnabled(convertRawProp(context, rawProps, "sharedCookiesEnabled", sourceProps.sharedCookiesEnabled, {false})),
|
|
73
|
+
textInteractionEnabled(convertRawProp(context, rawProps, "textInteractionEnabled", sourceProps.textInteractionEnabled, {true})),
|
|
74
|
+
useSharedProcessPool(convertRawProp(context, rawProps, "useSharedProcessPool", sourceProps.useSharedProcessPool, {true})),
|
|
75
|
+
menuItems(convertRawProp(context, rawProps, "menuItems", sourceProps.menuItems, {})),
|
|
76
|
+
suppressMenuItems(convertRawProp(context, rawProps, "suppressMenuItems", sourceProps.suppressMenuItems, {})),
|
|
77
|
+
hasOnFileDownload(convertRawProp(context, rawProps, "hasOnFileDownload", sourceProps.hasOnFileDownload, {false})),
|
|
78
|
+
fraudulentWebsiteWarningEnabled(convertRawProp(context, rawProps, "fraudulentWebsiteWarningEnabled", sourceProps.fraudulentWebsiteWarningEnabled, {true})),
|
|
79
|
+
allowFileAccessFromFileURLs(convertRawProp(context, rawProps, "allowFileAccessFromFileURLs", sourceProps.allowFileAccessFromFileURLs, {false})),
|
|
80
|
+
allowUniversalAccessFromFileURLs(convertRawProp(context, rawProps, "allowUniversalAccessFromFileURLs", sourceProps.allowUniversalAccessFromFileURLs, {false})),
|
|
81
|
+
applicationNameForUserAgent(convertRawProp(context, rawProps, "applicationNameForUserAgent", sourceProps.applicationNameForUserAgent, {})),
|
|
82
|
+
basicAuthCredential(convertRawProp(context, rawProps, "basicAuthCredential", sourceProps.basicAuthCredential, {})),
|
|
83
|
+
cacheEnabled(convertRawProp(context, rawProps, "cacheEnabled", sourceProps.cacheEnabled, {true})),
|
|
84
|
+
incognito(convertRawProp(context, rawProps, "incognito", sourceProps.incognito, {false})),
|
|
85
|
+
injectedJavaScript(convertRawProp(context, rawProps, "injectedJavaScript", sourceProps.injectedJavaScript, {})),
|
|
86
|
+
injectedJavaScriptBeforeContentLoaded(convertRawProp(context, rawProps, "injectedJavaScriptBeforeContentLoaded", sourceProps.injectedJavaScriptBeforeContentLoaded, {})),
|
|
87
|
+
injectedJavaScriptForMainFrameOnly(convertRawProp(context, rawProps, "injectedJavaScriptForMainFrameOnly", sourceProps.injectedJavaScriptForMainFrameOnly, {true})),
|
|
88
|
+
injectedJavaScriptBeforeContentLoadedForMainFrameOnly(convertRawProp(context, rawProps, "injectedJavaScriptBeforeContentLoadedForMainFrameOnly", sourceProps.injectedJavaScriptBeforeContentLoadedForMainFrameOnly, {true})),
|
|
89
|
+
javaScriptCanOpenWindowsAutomatically(convertRawProp(context, rawProps, "javaScriptCanOpenWindowsAutomatically", sourceProps.javaScriptCanOpenWindowsAutomatically, {false})),
|
|
90
|
+
javaScriptEnabled(convertRawProp(context, rawProps, "javaScriptEnabled", sourceProps.javaScriptEnabled, {true})),
|
|
91
|
+
webviewDebuggingEnabled(convertRawProp(context, rawProps, "webviewDebuggingEnabled", sourceProps.webviewDebuggingEnabled, {false})),
|
|
92
|
+
mediaPlaybackRequiresUserAction(convertRawProp(context, rawProps, "mediaPlaybackRequiresUserAction", sourceProps.mediaPlaybackRequiresUserAction, {true})),
|
|
93
|
+
messagingEnabled(convertRawProp(context, rawProps, "messagingEnabled", sourceProps.messagingEnabled, {false})),
|
|
94
|
+
shouldStartLoadWithRequestEnabled(convertRawProp(context, rawProps, "shouldStartLoadWithRequestEnabled", sourceProps.shouldStartLoadWithRequestEnabled, {false})),
|
|
95
|
+
hasOnOpenWindowEvent(convertRawProp(context, rawProps, "hasOnOpenWindowEvent", sourceProps.hasOnOpenWindowEvent, {false})),
|
|
96
|
+
showsHorizontalScrollIndicator(convertRawProp(context, rawProps, "showsHorizontalScrollIndicator", sourceProps.showsHorizontalScrollIndicator, {true})),
|
|
97
|
+
showsVerticalScrollIndicator(convertRawProp(context, rawProps, "showsVerticalScrollIndicator", sourceProps.showsVerticalScrollIndicator, {true})),
|
|
98
|
+
indicatorStyle(convertRawProp(context, rawProps, "indicatorStyle", sourceProps.indicatorStyle, {RNCWebViewIndicatorStyle::Default})),
|
|
99
|
+
newSource(convertRawProp(context, rawProps, "newSource", sourceProps.newSource, {})),
|
|
100
|
+
userAgent(convertRawProp(context, rawProps, "userAgent", sourceProps.userAgent, {}))
|
|
101
|
+
{}
|
|
107
102
|
|
|
108
103
|
} // namespace facebook::react
|
|
@@ -448,8 +448,6 @@ class RNCWebViewProps final : public ViewProps {
|
|
|
448
448
|
int textZoom{0};
|
|
449
449
|
bool thirdPartyCookiesEnabled{true};
|
|
450
450
|
bool hasOnScroll{false};
|
|
451
|
-
bool hasOnShouldStartLoadWithRequestEvent{false};
|
|
452
|
-
folly::dynamic originWhitelist{};
|
|
453
451
|
std::string injectedJavaScriptObject{};
|
|
454
452
|
bool paymentRequestEnabled{false};
|
|
455
453
|
std::string allowingReadAccessToURL{};
|
|
@@ -45,7 +45,6 @@ export interface WebViewProps extends ViewRawProps {
|
|
|
45
45
|
cacheMode: CACHE_MODE
|
|
46
46
|
domStorageEnabled: boolean
|
|
47
47
|
scalesPageToFit: boolean
|
|
48
|
-
hasOnShouldStartLoadWithRequestEvent?: boolean
|
|
49
48
|
messagingModuleName: string
|
|
50
49
|
webviewDebuggingEnabled: boolean
|
|
51
50
|
scrollEnabled: boolean
|
|
@@ -39,7 +39,7 @@ export const WEB_VIEW = "RNCWebView"
|
|
|
39
39
|
@Sendable
|
|
40
40
|
class WorkerRunnable implements WorkerTaskRunnable<ShouldStartParams> {
|
|
41
41
|
run(rnInstance: AnyThreadRNInstance, params: ShouldStartParams): void {
|
|
42
|
-
|
|
42
|
+
params.lockState = ShouldOverrideCallbackState.UNDECIDED
|
|
43
43
|
rnInstance.getTurboModule<WebViewTurboModule>(TM.RNCWebViewModule.NAME).setShouldStartParams(params)
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -376,33 +376,9 @@ export struct RNCWebView {
|
|
|
376
376
|
}
|
|
377
377
|
return permissionDialogMessage;
|
|
378
378
|
}
|
|
379
|
-
originWhitelistToRegex(originWhitelist: string): string {
|
|
380
|
-
const matchOperatorsRegex = /[|\\{}()[\]^$+*?.-]/g;
|
|
381
|
-
return `^${originWhitelist.replace(matchOperatorsRegex, '\\$&').replace(/\\\*/g, '.*')}`;
|
|
382
|
-
}
|
|
383
|
-
extractOrigin(url: string): string {
|
|
384
|
-
const result = /^[A-Za-z][A-Za-z0-9+\-.]+:(\/\/)?[^/]*/.exec(url);
|
|
385
|
-
return result === null ? '' : result[0];
|
|
386
|
-
};
|
|
387
|
-
passesWhitelist(compiledWhitelist: string[], url: string) {
|
|
388
|
-
const origin = this.extractOrigin(url);
|
|
389
|
-
return compiledWhitelist.some((x) => new RegExp(x).test(origin));
|
|
390
|
-
};
|
|
391
|
-
compileWhitelist(originWhitelist: string[]): string[] {
|
|
392
|
-
return ['about:blank', ...(originWhitelist || [])].map(this.originWhitelistToRegex);
|
|
393
|
-
}
|
|
394
379
|
|
|
395
380
|
onLoadIntercept(event: OnLoadInterceptEvent): boolean {
|
|
396
381
|
Logger.debug(TAG, `onLoadIntercept start`)
|
|
397
|
-
let originWhitelistArr = this.descriptorWrapper.rawProps.originWhitelist;
|
|
398
|
-
let hasOnShouldStartLoadWithRequestEventBool = this.descriptorWrapper.rawProps.hasOnShouldStartLoadWithRequestEvent
|
|
399
|
-
let urlString =
|
|
400
|
-
this.webViewBaseOperate?.verifyURLFormat(event.data.getRequestUrl(), this.source.html, this.source.baseUrl) || "";
|
|
401
|
-
|
|
402
|
-
if (this.passesWhitelist(this.compileWhitelist(originWhitelistArr), urlString) &&
|
|
403
|
-
!hasOnShouldStartLoadWithRequestEventBool) {
|
|
404
|
-
return false
|
|
405
|
-
}
|
|
406
382
|
this.webViewBaseOperate?.setLockIdentifier(BaseOperate.generateLockIdentifier())
|
|
407
383
|
|
|
408
384
|
const params = new ShouldStartParams();
|
|
@@ -425,6 +401,10 @@ export struct RNCWebView {
|
|
|
425
401
|
return false
|
|
426
402
|
}
|
|
427
403
|
|
|
404
|
+
onSslErrorEventCallback(event: SslErrorEvent){
|
|
405
|
+
this.webViewBaseOperate?.emitOnSslErrorEventCallback(event);
|
|
406
|
+
}
|
|
407
|
+
|
|
428
408
|
build() {
|
|
429
409
|
Stack() {
|
|
430
410
|
if ( deviceInfo.sdkApiVersion >= 20) {
|
|
@@ -499,6 +479,7 @@ export struct RNCWebView {
|
|
|
499
479
|
.onRenderExited((event: OnRenderExitedEvent) => this.webViewBaseOperate?.onRenderExited(event))
|
|
500
480
|
.onLoadIntercept((event: OnLoadInterceptEvent) => this.onLoadIntercept(event))
|
|
501
481
|
.onTitleReceive((event: OnTitleReceiveEvent) => this.webViewBaseOperate?.onTitleReceive(event))
|
|
482
|
+
.onSslErrorEvent((event: SslErrorEvent) => this.onSslErrorEventCallback(event))
|
|
502
483
|
} else {
|
|
503
484
|
Web({ src: "", controller: this.controller, renderMode: this.renderMode })
|
|
504
485
|
.mixedMode(this.mode)
|
|
@@ -571,7 +552,7 @@ export struct RNCWebView {
|
|
|
571
552
|
.onRenderExited((event: OnRenderExitedEvent) => this.webViewBaseOperate?.onRenderExited(event))
|
|
572
553
|
.onLoadIntercept((event: OnLoadInterceptEvent) => this.onLoadIntercept(event))
|
|
573
554
|
.onTitleReceive((event: OnTitleReceiveEvent) => this.webViewBaseOperate?.onTitleReceive(event))
|
|
574
|
-
|
|
555
|
+
.onSslErrorEvent((event: SslErrorEvent) => this.onSslErrorEventCallback(event))
|
|
575
556
|
}
|
|
576
557
|
}
|
|
577
558
|
.width(this.webviewWidth)
|
|
@@ -135,6 +135,50 @@ export class BaseOperate {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
emitOnSslErrorEventCallback(event: SslErrorEvent) {
|
|
139
|
+
try {
|
|
140
|
+
const referrerUrl = event.referrer;
|
|
141
|
+
const url = event.url;
|
|
142
|
+
event.handler.handleCancel(true);
|
|
143
|
+
if (referrerUrl.toLowerCase() != url.toLowerCase()) {
|
|
144
|
+
Logger.debug(TAG, "[RNOH] Resource blocked from loading due to SSL error. Blocked URL: " + url);
|
|
145
|
+
let description = "";
|
|
146
|
+
const descriptionPrefix = "SSL error: ";
|
|
147
|
+
switch (event.error) {
|
|
148
|
+
case SslError.DateInvalid:
|
|
149
|
+
description = "The date of the certificate is invalid";
|
|
150
|
+
break;
|
|
151
|
+
case SslError.HostMismatch:
|
|
152
|
+
description = "Hostname mismatch";
|
|
153
|
+
break;
|
|
154
|
+
case SslError.Invalid:
|
|
155
|
+
description = "A generic error occurred";
|
|
156
|
+
break;
|
|
157
|
+
case SslError.Untrusted:
|
|
158
|
+
description = "The certificate authority is not trusted";
|
|
159
|
+
break;
|
|
160
|
+
default:
|
|
161
|
+
description = "Unknown SSL Error";
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
description = descriptionPrefix + description;
|
|
165
|
+
this.eventEmitter!.emit('loadingSubResourceError', {
|
|
166
|
+
url: event.url,
|
|
167
|
+
loading: false,
|
|
168
|
+
title: this.controller.getTitle(),
|
|
169
|
+
canGoBack: this.controller.accessBackward(),
|
|
170
|
+
canGoForward: this.controller.accessForward(),
|
|
171
|
+
lockIdentifier: this.lockIdentifier,
|
|
172
|
+
domain: "",
|
|
173
|
+
code: event.error,
|
|
174
|
+
description: description
|
|
175
|
+
})
|
|
176
|
+
}
|
|
177
|
+
} catch (error) {
|
|
178
|
+
Logger.error(TAG, `[RNOH] emitLoadingError Errorcode: ${error.code}`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
138
182
|
emitHttpError(event: OnHttpErrorReceiveEvent) {
|
|
139
183
|
try {
|
|
140
184
|
this.eventEmitter!.emit('httpError', {
|
|
@@ -45,8 +45,6 @@ export namespace RNCWebView {
|
|
|
45
45
|
hasOnScroll?: boolean;
|
|
46
46
|
injectedJavaScriptObject?: string;
|
|
47
47
|
paymentRequestEnabled?: boolean;
|
|
48
|
-
hasOnShouldStartLoadWithRequestEvent?:boolean,
|
|
49
|
-
originWhitelist?:readonly string[];
|
|
50
48
|
allowingReadAccessToURL?: string;
|
|
51
49
|
allowsBackForwardNavigationGestures?: boolean;
|
|
52
50
|
allowsInlineMediaPlayback?: boolean;
|
|
@@ -455,6 +453,7 @@ export namespace RNCWebView {
|
|
|
455
453
|
"customMenuSelection": {label: string, key: string, selectedText: string}
|
|
456
454
|
"fileDownload": {downloadUrl: string}
|
|
457
455
|
"loadingError": {url: string, loading: boolean, title: string, canGoBack: boolean, canGoForward: boolean, lockIdentifier: number, domain?: string, code: number, description: string}
|
|
456
|
+
"loadingSubResourceError": {url: string, loading: boolean, title: string, canGoBack: boolean, canGoForward: boolean, lockIdentifier: number, domain?: string, code: number, description: string}
|
|
458
457
|
"loadingFinish": {url: string, loading: boolean, title: string, canGoBack: boolean, canGoForward: boolean, lockIdentifier: number, navigationType: 'click' | 'formsubmit' | 'backforward' | 'reload' | 'formresubmit' | 'other', mainDocumentURL?: string}
|
|
459
458
|
"loadingProgress": {url: string, loading: boolean, title: string, canGoBack: boolean, canGoForward: boolean, lockIdentifier: number, progress: number}
|
|
460
459
|
"loadingStart": {url: string, loading: boolean, title: string, canGoBack: boolean, canGoForward: boolean, lockIdentifier: number, navigationType: 'click' | 'formsubmit' | 'backforward' | 'reload' | 'formresubmit' | 'other', mainDocumentURL?: string}
|
package/harmony/rn_webview.har
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"Thibault Malbranche <malbranche.thibault@gmail.com>"
|
|
10
10
|
],
|
|
11
11
|
"license": "MIT",
|
|
12
|
-
"version": "13.
|
|
12
|
+
"version": "13.16.1-rc.1",
|
|
13
13
|
"homepage": "https://gitcode.com/openharmony-sig/rntpc_react-native-webview/tree/br_rnoh0.77#readme",
|
|
14
14
|
"scripts": {
|
|
15
15
|
"macos": "react-native run-macos --scheme WebviewExample --project-path example/macos",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"escape-string-regexp": "^4.0.0",
|
|
39
39
|
"invariant": "2.2.4",
|
|
40
|
-
"react-native-webview": "13.
|
|
40
|
+
"react-native-webview": "13.16.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@babel/cli": "^7.20.0",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"@react-native/eslint-config": "0.73.2",
|
|
49
49
|
"@react-native/metro-config": "0.73.5",
|
|
50
50
|
"@react-native/typescript-config": "0.73.1",
|
|
51
|
+
"@react-native-oh/react-native-harmony-cli": "file:./packages/rnoh-react-native-harmony-cli-0.82.1.tgz",
|
|
51
52
|
"@rnx-kit/metro-config": "1.3.15",
|
|
52
53
|
"@semantic-release/git": "7.0.16",
|
|
53
54
|
"@types/invariant": "^2.2.30",
|
|
@@ -246,8 +246,6 @@ export interface NativeProps extends ViewProps {
|
|
|
246
246
|
textInteractionEnabled?: WithDefault<boolean, true>;
|
|
247
247
|
useSharedProcessPool?: WithDefault<boolean, true>;
|
|
248
248
|
onContentProcessDidTerminate?: DirectEventHandler<WebViewNativeEvent>;
|
|
249
|
-
hasOnShouldStartLoadWithRequestEvent?: boolean;
|
|
250
|
-
originWhitelist?:readonly string[];
|
|
251
249
|
onCustomMenuSelection?: DirectEventHandler<WebViewCustomMenuSelectionEvent>;
|
|
252
250
|
onFileDownload?: DirectEventHandler<WebViewDownloadEvent>;
|
|
253
251
|
|
|
@@ -281,6 +279,7 @@ export interface NativeProps extends ViewProps {
|
|
|
281
279
|
messagingEnabled: boolean;
|
|
282
280
|
shouldStartLoadWithRequestEnabled: boolean;
|
|
283
281
|
onLoadingError: DirectEventHandler<WebViewErrorEvent>;
|
|
282
|
+
onLoadingSubResourceError: DirectEventHandler<WebViewErrorEvent>;
|
|
284
283
|
onLoadingFinish: DirectEventHandler<WebViewNavigationEvent>;
|
|
285
284
|
onLoadingProgress: DirectEventHandler<WebViewNativeProgressEvent>;
|
|
286
285
|
onLoadingStart: DirectEventHandler<WebViewNavigationEvent>;
|
package/src/WebView.harmony.tsx
CHANGED
|
@@ -52,7 +52,7 @@ const useWarnIfChanges = <T extends unknown>(value: T, name: string) => {
|
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
const WebViewComponent = forwardRef<{}, IOSWebViewProps & { scalesPageToFit: boolean, minimumFontSize: number, thirdPartyCookiesEnabled: boolean, geolocationEnabled: boolean }>(
|
|
55
|
+
const WebViewComponent = forwardRef<{}, IOSWebViewProps & {onLoadSubResourceError:()=>void, scalesPageToFit: boolean, minimumFontSize: number, thirdPartyCookiesEnabled: boolean, geolocationEnabled: boolean }>(
|
|
56
56
|
(
|
|
57
57
|
{
|
|
58
58
|
fraudulentWebsiteWarningEnabled = true,
|
|
@@ -67,7 +67,7 @@ const WebViewComponent = forwardRef<{}, IOSWebViewProps & { scalesPageToFit: boo
|
|
|
67
67
|
injectedJavaScript,
|
|
68
68
|
injectedJavaScriptBeforeContentLoaded,
|
|
69
69
|
injectedJavaScriptObject,
|
|
70
|
-
menuItems
|
|
70
|
+
menuItems=[],
|
|
71
71
|
injectedJavaScriptForMainFrameOnly = true,
|
|
72
72
|
injectedJavaScriptBeforeContentLoadedForMainFrameOnly = true,
|
|
73
73
|
thirdPartyCookiesEnabled = false,
|
|
@@ -75,6 +75,7 @@ const WebViewComponent = forwardRef<{}, IOSWebViewProps & { scalesPageToFit: boo
|
|
|
75
75
|
webviewDebuggingEnabled = false,
|
|
76
76
|
paymentRequestEnabled = false,
|
|
77
77
|
startInLoadingState,
|
|
78
|
+
onLoadSubResourceError,
|
|
78
79
|
onNavigationStateChange,
|
|
79
80
|
onLoadStart,
|
|
80
81
|
onCustomMenuSelection,
|
|
@@ -97,15 +98,15 @@ const WebViewComponent = forwardRef<{}, IOSWebViewProps & { scalesPageToFit: boo
|
|
|
97
98
|
allowsInlineMediaPlayback,
|
|
98
99
|
allowsPictureInPictureMediaPlayback,
|
|
99
100
|
allowsAirPlayForMediaPlayback,
|
|
100
|
-
mediaPlaybackRequiresUserAction
|
|
101
|
+
mediaPlaybackRequiresUserAction=true,
|
|
101
102
|
dataDetectorTypes,
|
|
102
103
|
incognito,
|
|
103
104
|
decelerationRate: decelerationRateProp,
|
|
104
105
|
onShouldStartLoadWithRequest: onShouldStartLoadWithRequestProp,
|
|
105
106
|
onStartShouldSetResponder,
|
|
106
107
|
onMoveShouldSetResponderCapture,
|
|
107
|
-
pullToRefreshEnabled
|
|
108
|
-
refreshControlLightMode
|
|
108
|
+
pullToRefreshEnabled=false,
|
|
109
|
+
refreshControlLightMode=false,
|
|
109
110
|
onResponderMove,
|
|
110
111
|
...otherProps
|
|
111
112
|
},
|
|
@@ -134,6 +135,7 @@ const WebViewComponent = forwardRef<{}, IOSWebViewProps & { scalesPageToFit: boo
|
|
|
134
135
|
lastErrorEvent,
|
|
135
136
|
onHttpError,
|
|
136
137
|
onLoadingError,
|
|
138
|
+
onLoadingSubResourceError,
|
|
137
139
|
onLoadingFinish,
|
|
138
140
|
onLoadingProgress,
|
|
139
141
|
onOpenWindow,
|
|
@@ -142,6 +144,7 @@ const WebViewComponent = forwardRef<{}, IOSWebViewProps & { scalesPageToFit: boo
|
|
|
142
144
|
onNavigationStateChange,
|
|
143
145
|
onLoad,
|
|
144
146
|
onError,
|
|
147
|
+
onLoadSubResourceError,
|
|
145
148
|
onHttpErrorProp,
|
|
146
149
|
onLoadEnd,
|
|
147
150
|
onLoadProgress,
|
|
@@ -275,6 +278,7 @@ const WebViewComponent = forwardRef<{}, IOSWebViewProps & { scalesPageToFit: boo
|
|
|
275
278
|
messagingEnabled={typeof onMessageProp === 'function'}
|
|
276
279
|
messagingModuleName="" // android ONLY
|
|
277
280
|
onLoadingError={onLoadingError}
|
|
281
|
+
onLoadingSubResourceError = {onLoadingSubResourceError}
|
|
278
282
|
onLoadingFinish={onLoadingFinish}
|
|
279
283
|
onLoadingProgress={onLoadingProgress}
|
|
280
284
|
onScroll={onScroll}
|
|
@@ -310,8 +314,6 @@ const WebViewComponent = forwardRef<{}, IOSWebViewProps & { scalesPageToFit: boo
|
|
|
310
314
|
mediaPlaybackRequiresUserAction={mediaPlaybackRequiresUserAction}
|
|
311
315
|
menuItems={menuItems}
|
|
312
316
|
newSource={newSource}
|
|
313
|
-
originWhitelist={originWhitelist}
|
|
314
|
-
hasOnShouldStartLoadWithRequestEvent={onShouldStartLoadWithRequestProp !== undefined}
|
|
315
317
|
style={webViewStyles}
|
|
316
318
|
webviewDebuggingEnabled={webviewDebuggingEnabled}
|
|
317
319
|
paymentRequestEnabled={paymentRequestEnabled}
|