@react-native-ohos/react-native-webview 13.10.5 → 13.10.6-beta.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 +25 -0
  2. package/LICENSE +21 -21
  3. package/README.md +396 -13
  4. package/harmony/rn_webview/.gitignore +6 -0
  5. package/harmony/rn_webview/BuildProfile.ets +16 -40
  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 -19
  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 +222 -206
  35. package/harmony/rn_webview/src/main/ets/RNCWebView.ets +907 -771
  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 -477
  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 -105
  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,206 +1,222 @@
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
- import { Descriptor, ViewBaseProps, ViewDescriptorWrapperBase, ViewRawProps } from '@rnoh/react-native-openharmony'
26
-
27
- export class WebViewNewSourceHeader {
28
- name?: string
29
- value?: string
30
- }
31
-
32
-
33
- export class WebViewNewSource {
34
- uri?: string | Resource
35
- method?: string
36
- body?: string
37
- headers?: WebViewNewSourceHeader[]
38
- html?: string
39
- baseUrl?: string
40
- }
41
-
42
- export interface AlertEvent {
43
- url: string;
44
- message: string;
45
- result: JsResult;
46
- }
47
-
48
- export const TAG = "WebView"
49
-
50
- export const WEB_VIEW = "RNCWebView"
51
-
52
- export const JAVASCRIPT_INTERFACE = "ReactNativeWebView";
53
-
54
- export interface WebViewProps extends ViewRawProps {
55
- width: number
56
- height: number
57
- newSource: WebViewNewSource
58
- javaScriptEnabled: boolean
59
- injectedJavaScript: string
60
- messagingEnabled: boolean
61
- showsHorizontalScrollIndicator: boolean
62
- showsVerticalScrollIndicator: boolean
63
- textZoom: number
64
- cacheEnabled: boolean
65
- cacheMode: CACHE_MODE
66
- domStorageEnabled: boolean
67
- scalesPageToFit: boolean
68
- messagingModuleName: string
69
- webviewDebuggingEnabled: boolean
70
- scrollEnabled: boolean
71
- incognito: boolean
72
- userAgent: string
73
- shouldStartLoadWithRequestEnabled: boolean
74
- hasOnShouldStartLoadWithRequestEvent?: boolean
75
- originWhitelist: Array<string>
76
- thirdPartyCookiesEnabled: boolean
77
- fraudulentWebsiteWarningEnabled: boolean
78
- ignoreSilentHardwareSwitch: boolean
79
- forceDarkOn: boolean
80
- minimumFontSize: number
81
- bounces: boolean
82
- injectedJavaScriptBeforeContentLoaded: string
83
- overScrollMode: WebViewOverScrollMode,
84
- mediaPlaybackRequiresUserAction: boolean
85
- geolocationEnabled: boolean
86
- applicationNameForUserAgent: string
87
- pullToRefreshEnabled: boolean
88
- schemeList: Array<string>
89
- }
90
-
91
-
92
- export class RNCWebViewBridge {
93
- postMessage!: (data: string) => void;
94
- }
95
-
96
- export class WebViewEventParams {
97
- type: string
98
- url?: string
99
- loading?: boolean
100
- title?: string
101
- canGoBack?: boolean
102
- canGoForward?: boolean
103
- lockIdentifier?: number
104
- data?: string
105
-
106
- constructor(type: string) {
107
- this.type = type
108
- }
109
- }
110
-
111
- export enum CACHE_MODE {
112
- 'LOAD_DEFAULT' = 'LOAD_DEFAULT',
113
- 'LOAD_CACHE_ELSE_NETWORK' = 'LOAD_CACHE_ELSE_NETWORK',
114
- 'LOAD_NO_CACHE' = 'LOAD_NO_CACHE',
115
- 'LOAD_CACHE_ONLY' = 'LOAD_CACHE_ONLY',
116
- }
117
-
118
- export class ResultType {
119
- url: string
120
- loading: boolean
121
- title: string
122
- canGoBack: boolean
123
- canGoForward: boolean
124
- lockIdentifier: number
125
- data: string
126
-
127
- constructor(url: string, loading: boolean, title: string, canGoBack: boolean, canGoForward: boolean,
128
- lockIdentifier: number, data: string) {
129
- this.url = url
130
- this.loading = loading
131
- this.title = title
132
- this.canGoBack = canGoBack
133
- this.canGoForward = canGoForward
134
- this.lockIdentifier = lockIdentifier
135
- this.data = data
136
- }
137
- }
138
-
139
- interface WebViewState {}
140
-
141
- export type WebViewDescriptor = Descriptor<"WebView", ViewBaseProps, WebViewState, WebViewProps>
142
-
143
- export class WebViewViewDescriptorWrapper extends ViewDescriptorWrapperBase<"WebView", ViewBaseProps, WebViewState, WebViewProps> {
144
- }
145
-
146
-
147
- export const ZERO: number = 0
148
-
149
- export const EIGHT: number = 8;
150
-
151
- export const ONE_HUNDRED: number = 100
152
-
153
- export const REFRESH_OFFSET: number = 120
154
-
155
- export const MINHEIGHT: number = 1
156
-
157
- export interface ProgressInterface {
158
- progress: number;
159
- }
160
-
161
- export interface LoadingErrorInterface {
162
- code: number,
163
- description: string
164
- }
165
-
166
- export interface ScrollInterface {
167
- x: number,
168
- y: number
169
- }
170
-
171
- export enum WebViewOverScrollMode {
172
- ALWAYS = "always",
173
- NEVER = "never"
174
- }
175
-
176
- export enum COMMAND_NAME {
177
- INJECTJAVASCRIPT = 'injectJavaScript',
178
- POSTMESSAGE = 'postMessage',
179
- RELOAD = 'reload',
180
- GOBACK = 'goBack',
181
- GOFORWARD = 'goForward',
182
- REQUESTFOCUS = 'requestFocus',
183
- CLEARCACHE = 'clearCache',
184
- CLEARHISTORY = 'clearHistory',
185
- STOPLOADING = 'stopLoading',
186
- LOADURL = 'loadUrl'
187
- }
188
-
189
- interface RenderExitReasonMessageItem {
190
- errorDomain: string
191
- errorDesc: string
192
- }
193
-
194
- export const RenderExitReasonMessage = new Map<number, RenderExitReasonMessageItem>()
195
-
196
- RenderExitReasonMessage.set(0,
197
- { errorDomain: 'ProcessAbnormalTermination', errorDesc: "The rendering process exits abnormally." })
198
- RenderExitReasonMessage.set(1,
199
- { errorDomain: 'ProcessWasKilled', errorDesc: "SIGKILL is received or manually terminated." })
200
- RenderExitReasonMessage.set(2,
201
- { errorDomain: 'ProcessCrashed', errorDesc: "The rendering process crashes and exits, such as a segment error." })
202
- RenderExitReasonMessage.set(3,
203
- { errorDomain: 'ProcessOom', errorDesc: "The program is out of memory." })
204
- RenderExitReasonMessage.set(4,
205
- { errorDomain: 'ProcessExitUnknown', errorDesc: "Other reasons." })
206
-
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
+ import { Descriptor, ViewBaseProps, ViewDescriptorWrapperBase, ViewRawProps } from '@rnoh/react-native-openharmony'
26
+
27
+ export class WebViewNewSourceHeader {
28
+ name?: string
29
+ value?: string
30
+ }
31
+
32
+
33
+ export class WebViewNewSource {
34
+ uri?: string | Resource
35
+ method?: string
36
+ body?: string
37
+ headers?: WebViewNewSourceHeader[]
38
+ html?: string
39
+ baseUrl?: string
40
+ }
41
+
42
+ export interface AlertEvent {
43
+ url: string;
44
+ message: string;
45
+ result: JsResult;
46
+ }
47
+
48
+ export const TAG = "WebView"
49
+
50
+ export const WEB_VIEW = "RNCWebView"
51
+
52
+ export const JAVASCRIPT_INTERFACE = "ReactNativeWebView";
53
+
54
+ export interface WebViewProps extends ViewRawProps {
55
+ width: number
56
+ height: number
57
+ newSource: WebViewNewSource
58
+ javaScriptEnabled: boolean
59
+ injectedJavaScript: string
60
+ messagingEnabled: boolean
61
+ showsHorizontalScrollIndicator: boolean
62
+ showsVerticalScrollIndicator: boolean
63
+ textZoom: number
64
+ cacheEnabled: boolean
65
+ cacheMode: CACHE_MODE
66
+ domStorageEnabled: boolean
67
+ scalesPageToFit: boolean
68
+ messagingModuleName: string
69
+ webviewDebuggingEnabled: boolean
70
+ scrollEnabled: boolean
71
+ incognito: boolean
72
+ userAgent: string
73
+ shouldStartLoadWithRequestEnabled: boolean
74
+ hasOnShouldStartLoadWithRequestEvent?: boolean
75
+ originWhitelist: Array<string>
76
+ thirdPartyCookiesEnabled: boolean
77
+ fraudulentWebsiteWarningEnabled: boolean
78
+ ignoreSilentHardwareSwitch: boolean
79
+ forceDarkOn: boolean
80
+ minimumFontSize: number
81
+ bounces: boolean
82
+ injectedJavaScriptBeforeContentLoaded: string
83
+ overScrollMode: WebViewOverScrollMode,
84
+ mediaPlaybackRequiresUserAction: boolean
85
+ geolocationEnabled: boolean
86
+ applicationNameForUserAgent: string
87
+ pullToRefreshEnabled: boolean
88
+ schemeList: Array<string>
89
+ renderMode: "SYNC_RENDER" | "ASYNC_RENDER",
90
+ mediaCapturePermissionGrantType?: 'prompt' | 'grant' | 'deny' | 'grantIfSameHostElsePrompt' | 'grantIfSameHostElseDeny'
91
+ menuItems?: Array<MenuItem> | undefined;
92
+ }
93
+
94
+ export interface MenuItem {
95
+ label: string,
96
+ key: string
97
+ }
98
+
99
+ export enum WebMediaCapturePermissionGrantType {
100
+ GRANT_IF_SAME_HOST_ELSE_PROMPT = "grantIfSameHostElsePrompt",
101
+ GRANT_IF_SAME_HOST_ELSE_DENY = "grantIfSameHostElseDeny",
102
+ DENY = "deny",
103
+ GRANT = "grant",
104
+ PROMPT = "prompt",
105
+ }
106
+
107
+
108
+ export class RNCWebViewBridge {
109
+ postMessage!: (data: string) => void;
110
+ }
111
+
112
+ export class WebViewEventParams {
113
+ type: string
114
+ url?: string
115
+ loading?: boolean
116
+ title?: string
117
+ canGoBack?: boolean
118
+ canGoForward?: boolean
119
+ lockIdentifier?: number
120
+ data?: string
121
+
122
+ constructor(type: string) {
123
+ this.type = type
124
+ }
125
+ }
126
+
127
+ export enum CACHE_MODE {
128
+ 'LOAD_DEFAULT' = 'LOAD_DEFAULT',
129
+ 'LOAD_CACHE_ELSE_NETWORK' = 'LOAD_CACHE_ELSE_NETWORK',
130
+ 'LOAD_NO_CACHE' = 'LOAD_NO_CACHE',
131
+ 'LOAD_CACHE_ONLY' = 'LOAD_CACHE_ONLY',
132
+ }
133
+
134
+ export class ResultType {
135
+ url: string
136
+ loading: boolean
137
+ title: string
138
+ canGoBack: boolean
139
+ canGoForward: boolean
140
+ lockIdentifier: number
141
+ data: string
142
+
143
+ constructor(url: string, loading: boolean, title: string, canGoBack: boolean, canGoForward: boolean,
144
+ lockIdentifier: number, data: string) {
145
+ this.url = url
146
+ this.loading = loading
147
+ this.title = title
148
+ this.canGoBack = canGoBack
149
+ this.canGoForward = canGoForward
150
+ this.lockIdentifier = lockIdentifier
151
+ this.data = data
152
+ }
153
+ }
154
+
155
+ interface WebViewState {}
156
+
157
+ export type WebViewDescriptor = Descriptor<"WebView", ViewBaseProps, WebViewState, WebViewProps>
158
+
159
+ export class WebViewViewDescriptorWrapper extends ViewDescriptorWrapperBase<"WebView", ViewBaseProps, WebViewState, WebViewProps> {
160
+ }
161
+
162
+
163
+ export const ZERO: number = 0
164
+
165
+ export const EIGHT: number = 8;
166
+
167
+ export const ONE_HUNDRED: number = 100
168
+
169
+ export const REFRESH_OFFSET: number = 120
170
+
171
+ export const MINHEIGHT: number = 1
172
+
173
+ export interface ProgressInterface {
174
+ progress: number;
175
+ }
176
+
177
+ export interface LoadingErrorInterface {
178
+ code: number,
179
+ description: string
180
+ }
181
+
182
+ export interface ScrollInterface {
183
+ x: number,
184
+ y: number
185
+ }
186
+
187
+ export enum WebViewOverScrollMode {
188
+ ALWAYS = "always",
189
+ NEVER = "never"
190
+ }
191
+
192
+ export enum COMMAND_NAME {
193
+ INJECTJAVASCRIPT = 'injectJavaScript',
194
+ POSTMESSAGE = 'postMessage',
195
+ RELOAD = 'reload',
196
+ GOBACK = 'goBack',
197
+ GOFORWARD = 'goForward',
198
+ REQUESTFOCUS = 'requestFocus',
199
+ CLEARCACHE = 'clearCache',
200
+ CLEARHISTORY = 'clearHistory',
201
+ STOPLOADING = 'stopLoading',
202
+ LOADURL = 'loadUrl'
203
+ }
204
+
205
+ interface RenderExitReasonMessageItem {
206
+ errorDomain: string
207
+ errorDesc: string
208
+ }
209
+
210
+ export const RenderExitReasonMessage = new Map<number, RenderExitReasonMessageItem>()
211
+
212
+ RenderExitReasonMessage.set(0,
213
+ { errorDomain: 'ProcessAbnormalTermination', errorDesc: "The rendering process exits abnormally." })
214
+ RenderExitReasonMessage.set(1,
215
+ { errorDomain: 'ProcessWasKilled', errorDesc: "SIGKILL is received or manually terminated." })
216
+ RenderExitReasonMessage.set(2,
217
+ { errorDomain: 'ProcessCrashed', errorDesc: "The rendering process crashes and exits, such as a segment error." })
218
+ RenderExitReasonMessage.set(3,
219
+ { errorDomain: 'ProcessOom', errorDesc: "The program is out of memory." })
220
+ RenderExitReasonMessage.set(4,
221
+ { errorDomain: 'ProcessExitUnknown', errorDesc: "Other reasons." })
222
+