@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,607 @@
|
|
|
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 { RNComponentContext } from '@rnoh/react-native-openharmony';
|
|
26
|
+
import webview from '@ohos.web.webview';
|
|
27
|
+
import { url as OSUrl } from '@kit.ArkTS';
|
|
28
|
+
import { RNC, TM } from './generated';
|
|
29
|
+
import Logger from './Logger';
|
|
30
|
+
import { BaseOperate } from './WebViewBaseOperate';
|
|
31
|
+
import {
|
|
32
|
+
AlertEvent,
|
|
33
|
+
CACHE_MODE,
|
|
34
|
+
JAVASCRIPT_INTERFACE,
|
|
35
|
+
ONE_HUNDRED,
|
|
36
|
+
EIGHT,
|
|
37
|
+
ResultType,
|
|
38
|
+
RNCWebViewBridge,
|
|
39
|
+
WebViewEventParams,
|
|
40
|
+
WebViewNewSource,
|
|
41
|
+
WebViewOverScrollMode,
|
|
42
|
+
ZERO,
|
|
43
|
+
COMMAND_NAME,
|
|
44
|
+
WebViewDescriptor,
|
|
45
|
+
REFRESH_OFFSET,
|
|
46
|
+
MINHEIGHT,
|
|
47
|
+
} from './Magic';
|
|
48
|
+
|
|
49
|
+
import { bundleManager } from '@kit.AbilityKit';
|
|
50
|
+
import { WebViewTurboModule, ShouldStartParams, ShouldOverrideCallbackState } from './WebViewTurboModule';
|
|
51
|
+
import { AnyThreadRNInstance, WorkerTaskRunnable } from '@rnoh/react-native-openharmony/src/main/ets/RNOH';
|
|
52
|
+
import buffer from '@ohos.buffer';
|
|
53
|
+
|
|
54
|
+
export const TAG = "WebView"
|
|
55
|
+
|
|
56
|
+
export const WEB_VIEW = "RNCWebView"
|
|
57
|
+
|
|
58
|
+
@Sendable
|
|
59
|
+
class WorkerRunnable implements WorkerTaskRunnable<ShouldStartParams> {
|
|
60
|
+
run(rnInstance: AnyThreadRNInstance, params: ShouldStartParams): void {
|
|
61
|
+
rnInstance.getTurboModule<WebViewTurboModule>(TM.RNCWebViewModule.NAME).setShouldStartParams(params)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@Component
|
|
66
|
+
export struct RNCWebView {
|
|
67
|
+
public static readonly NAME = RNC.RNCWebView.NAME
|
|
68
|
+
ctx!: RNComponentContext
|
|
69
|
+
tag: number = ZERO
|
|
70
|
+
source: WebViewNewSource = {
|
|
71
|
+
uri: "",
|
|
72
|
+
method: "",
|
|
73
|
+
body: "",
|
|
74
|
+
html: "",
|
|
75
|
+
baseUrl: ""
|
|
76
|
+
}
|
|
77
|
+
html: string | undefined = "";
|
|
78
|
+
url: string | Resource = "";
|
|
79
|
+
body: string | undefined = "";
|
|
80
|
+
controller: webview.WebviewController = new webview.WebviewController();
|
|
81
|
+
schemeHandler: webview.WebSchemeHandler = new webview.WebSchemeHandler();
|
|
82
|
+
javaScriptEnable: boolean = true;
|
|
83
|
+
allowFileAccess: boolean = true;
|
|
84
|
+
forceDark: boolean = true;
|
|
85
|
+
minFontSize: number = EIGHT;
|
|
86
|
+
overScrollMode: OverScrollMode = OverScrollMode.NEVER;
|
|
87
|
+
progress: number = ZERO;
|
|
88
|
+
cacheMode: number = CacheMode.Default;
|
|
89
|
+
requestUrl: string = "";
|
|
90
|
+
bundleName: string = "";
|
|
91
|
+
messagingEnabled: boolean = false;
|
|
92
|
+
hasRegisterJavaScriptProxy: boolean = false;
|
|
93
|
+
controllerAttached: boolean = false;
|
|
94
|
+
renderMode: RenderMode = RenderMode.SYNC_RENDER;
|
|
95
|
+
scrollEnabled = true;
|
|
96
|
+
nestedScroll = NestedScrollMode.SELF_FIRST;
|
|
97
|
+
headers: Array<webview.WebHeader> = []
|
|
98
|
+
injectedJavaScriptBeforeContentLoaded: Array<ScriptItem> = [
|
|
99
|
+
{ script: '', scriptRules: ["*"] }
|
|
100
|
+
];
|
|
101
|
+
allowPageStartInProgress = true;
|
|
102
|
+
@State webviewWidth: number = ZERO
|
|
103
|
+
@State webviewHeight: number = ZERO
|
|
104
|
+
@State isRefreshing: boolean = false
|
|
105
|
+
@State mode: MixedMode = MixedMode.All;
|
|
106
|
+
private unregisterDescriptorChangesListener?: () => void = undefined
|
|
107
|
+
private cleanupCommandCallback?: () => void = undefined
|
|
108
|
+
private eventEmitter: RNC.RNCWebView.EventEmitter | undefined = undefined
|
|
109
|
+
private cleanUpCallbacks: (() => void)[] = []
|
|
110
|
+
private descriptorWrapper: WebViewDescriptor = Object() as WebViewDescriptor
|
|
111
|
+
private webViewBaseOperate: BaseOperate | null = null
|
|
112
|
+
private shouldInterceptLoad: boolean = true
|
|
113
|
+
private callLoadTimer: number = -1
|
|
114
|
+
static readonly SHOULD_OVERRIDE_URL_LOADING_TIMEOUT: number = 250
|
|
115
|
+
|
|
116
|
+
aboutToAppear() {
|
|
117
|
+
try {
|
|
118
|
+
this.initVariable()
|
|
119
|
+
this.getBundleName()
|
|
120
|
+
this.url = this.source.uri as string;
|
|
121
|
+
this.onDescriptorWrapperChange(this.descriptorWrapper)
|
|
122
|
+
this.unregisterDescriptorChangesListener = this.ctx.descriptorRegistry.subscribeToDescriptorChanges(this.tag,
|
|
123
|
+
(newDescriptor) => {
|
|
124
|
+
this.onDescriptorWrapperChange(newDescriptor as WebViewDescriptor)
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
BaseOperate.setThirdPartyCookiesEnabled(this.descriptorWrapper.rawProps.thirdPartyCookiesEnabled)
|
|
128
|
+
webview.WebviewController.setWebDebuggingAccess(this.descriptorWrapper.rawProps.webviewDebuggingEnabled)
|
|
129
|
+
this.registerCommandCallback()
|
|
130
|
+
if (this.hasIncognito()) {
|
|
131
|
+
this.cacheMode = CacheMode.Online;
|
|
132
|
+
}
|
|
133
|
+
if (this.source.headers) {
|
|
134
|
+
this.source.headers.forEach(item => {
|
|
135
|
+
if (item.name && item.value) {
|
|
136
|
+
this.headers.push({ headerKey: item.name, headerValue: item.value })
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
}
|
|
140
|
+
} catch (error) {
|
|
141
|
+
Logger.error(TAG, `[RNOH]Errorcode: ${error.code}, Message: ${error.message}`);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
hasIncognito(): boolean {
|
|
147
|
+
return this.descriptorWrapper.rawProps.incognito && this.descriptorWrapper.rawProps.incognito === true
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
createWebViewEvent(type: string): WebViewEventParams {
|
|
151
|
+
return this.webViewBaseOperate?.createWebViewEvent({ type, progress: this.progress }) as WebViewEventParams;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
aboutToDisappear() {
|
|
155
|
+
this.getUIContext().getFocusController().clearFocus()
|
|
156
|
+
this.cleanupCommandCallback?.()
|
|
157
|
+
this.unregisterDescriptorChangesListener?.()
|
|
158
|
+
this.cleanUpCallbacks.forEach(cb => cb())
|
|
159
|
+
try {
|
|
160
|
+
if (this.hasIncognito()) {
|
|
161
|
+
this.webViewBaseOperate?.setIncognito()
|
|
162
|
+
}
|
|
163
|
+
this.controller.deleteJavaScriptRegister(JAVASCRIPT_INTERFACE)
|
|
164
|
+
this.controller.refresh()
|
|
165
|
+
this.hasRegisterJavaScriptProxy = false
|
|
166
|
+
this.webViewBaseOperate = null
|
|
167
|
+
} catch (error) {
|
|
168
|
+
Logger.error(TAG, `[RNOH]Errorcode: ${error.code}, Message: ${error.message}`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
registerCommandCallback() {
|
|
173
|
+
this.cleanupCommandCallback = this.ctx.componentCommandReceiver.registerCommandCallback(
|
|
174
|
+
this.tag,
|
|
175
|
+
(command: COMMAND_NAME, args: string[]) => this.webViewBaseOperate?.registerCommandCallback(command, args));
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
onLoadingStart() {
|
|
179
|
+
this.webViewBaseOperate?.emitLoadingStart({ progress: this.progress })
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
onProgressChange(event: OnProgressChangeEvent) {
|
|
183
|
+
this.progress = event.newProgress
|
|
184
|
+
// 修复单页面应用切换路由时 onPageBegin 未触发的问题
|
|
185
|
+
if (this.controller.getUrl() !== this.url && this.progress < ONE_HUNDRED && this.allowPageStartInProgress) {
|
|
186
|
+
this.allowPageStartInProgress = false;
|
|
187
|
+
this.onLoadingStart();
|
|
188
|
+
}
|
|
189
|
+
this.webViewBaseOperate?.emitProgressChange({ progress: this.progress })
|
|
190
|
+
if (this.progress === ONE_HUNDRED) {
|
|
191
|
+
this.allowPageStartInProgress = true;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
onLoadingFinish() {
|
|
196
|
+
this.webViewBaseOperate?.emitLoadingFinish({ progress: this.progress })
|
|
197
|
+
this.isRefreshing = false
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
runInjectedJavaScript() {
|
|
201
|
+
let injectedJS = this.descriptorWrapper.rawProps.injectedJavaScript
|
|
202
|
+
if (this.javaScriptEnable && injectedJS != "" && this.controllerAttached) {
|
|
203
|
+
try {
|
|
204
|
+
this.controller.runJavaScript("(function() {\n" + injectedJS + ";\n})();")
|
|
205
|
+
.then((result) => {
|
|
206
|
+
Logger.debug(TAG, '[RNOH] result: ' + result);
|
|
207
|
+
})
|
|
208
|
+
.catch((error: string | Error) => {
|
|
209
|
+
Logger.error(TAG, "[RNOH] error: " + error);
|
|
210
|
+
})
|
|
211
|
+
} catch (error) {
|
|
212
|
+
Logger.error(TAG, `[RNOH]Errorcode: ${error.code}, Message: ${error.message}`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
getJsDialogTitle() {
|
|
218
|
+
const url = this.controller.getUrl()
|
|
219
|
+
// 对于 data: URL,只显示 'JavaScript',类似于 Chrome
|
|
220
|
+
let title = 'JavaScript';
|
|
221
|
+
const isDataUrl = (url !== null) && url.startsWith("data:");
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
if (!isDataUrl) {
|
|
225
|
+
try {
|
|
226
|
+
const dialogUrl = OSUrl.URL.parseURL(url);
|
|
227
|
+
title = `网址为”${dialogUrl.protocol}//${dialogUrl.host}“的网页显示:`;
|
|
228
|
+
} catch (ex) {
|
|
229
|
+
title = url;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return title;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
onJavascriptAlert(event?: AlertEvent) {
|
|
237
|
+
if (event) {
|
|
238
|
+
AlertDialog.show({
|
|
239
|
+
title: this.getJsDialogTitle(),
|
|
240
|
+
message: event.message,
|
|
241
|
+
alignment: DialogAlignment.Center,
|
|
242
|
+
secondaryButton: {
|
|
243
|
+
value: this.resourceToString($r('app.string.determined')),
|
|
244
|
+
action: () => event.result.handleConfirm()
|
|
245
|
+
},
|
|
246
|
+
cancel: () => event.result.handleCancel(),
|
|
247
|
+
})
|
|
248
|
+
}
|
|
249
|
+
return true
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
onJavascriptConfirm(event?: AlertEvent) {
|
|
253
|
+
if (event) {
|
|
254
|
+
AlertDialog.show({
|
|
255
|
+
title: this.getJsDialogTitle(),
|
|
256
|
+
message: event.message,
|
|
257
|
+
alignment: DialogAlignment.Center,
|
|
258
|
+
secondaryButton: {
|
|
259
|
+
value: this.resourceToString($r('app.string.determined')),
|
|
260
|
+
action: () => event.result.handleConfirm()
|
|
261
|
+
},
|
|
262
|
+
cancel: () => event.result.handleCancel(),
|
|
263
|
+
primaryButton: {
|
|
264
|
+
value: this.resourceToString($r('app.string.cancel')),
|
|
265
|
+
action: () => event.result.handleCancel()
|
|
266
|
+
},
|
|
267
|
+
})
|
|
268
|
+
}
|
|
269
|
+
return true
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
ignoreSilentHardwareSwitchMethods(ignoreSilentHardwareSwitch: boolean) {
|
|
273
|
+
this.webViewBaseOperate?.ignoreSilentHardwareSwitchMethods(ignoreSilentHardwareSwitch)
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
loadHtmlData(html: string = '', url: string = '') {
|
|
277
|
+
try {
|
|
278
|
+
this.controller.loadData(
|
|
279
|
+
html,
|
|
280
|
+
"text/html",
|
|
281
|
+
"UTF-8",
|
|
282
|
+
url,
|
|
283
|
+
" "
|
|
284
|
+
);
|
|
285
|
+
} catch (error) {
|
|
286
|
+
Logger.error(TAG, "error:" + error)
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
controllerAttachedInit(): void {
|
|
291
|
+
this.controllerAttached = true;
|
|
292
|
+
this.eventEmitter = new RNC.RNCWebView.EventEmitter(this.ctx.rnInstance, this.tag)
|
|
293
|
+
this.webViewBaseOperate = new BaseOperate(this.eventEmitter, this.controller)
|
|
294
|
+
this.webViewBaseOperate.setCustomUserAgent(this.descriptorWrapper.rawProps.userAgent,
|
|
295
|
+
this.descriptorWrapper.rawProps.applicationNameForUserAgent)
|
|
296
|
+
this.webViewBaseOperate.setFraudulentWebsiteWarningEnabled(this.descriptorWrapper.rawProps.fraudulentWebsiteWarningEnabled)
|
|
297
|
+
|
|
298
|
+
let schemeList = this.descriptorWrapper.rawProps.schemeList
|
|
299
|
+
if(schemeList?.length){
|
|
300
|
+
schemeList.forEach(scheme=>{
|
|
301
|
+
this.schemeHandler.onRequestStart((request: webview.WebSchemeHandlerRequest, resourceHandler: webview.WebResourceHandler) => {
|
|
302
|
+
console.log("[schemeHandler] onRequestStart");
|
|
303
|
+
return true;
|
|
304
|
+
})
|
|
305
|
+
this.schemeHandler.onRequestStop((request: webview.WebSchemeHandlerRequest) => {
|
|
306
|
+
console.log("[schemeHandler] onRequestStop");
|
|
307
|
+
});
|
|
308
|
+
this.controller.setWebSchemeHandler(scheme, this.schemeHandler);
|
|
309
|
+
})
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
let baseUrl = this.source.baseUrl
|
|
313
|
+
let uri = this.source.uri
|
|
314
|
+
if (this.source.html != undefined && this.source.html != "") {
|
|
315
|
+
this.loadHtmlData(this.source.html, baseUrl)
|
|
316
|
+
} else if (uri != undefined && uri != "") {
|
|
317
|
+
if (this.source.method && this.source.method.toUpperCase() === 'POST' && this.source.body) {
|
|
318
|
+
let postData = buffer.from(this.source.body);
|
|
319
|
+
let url = uri as string;
|
|
320
|
+
this.controller.postUrl(url, postData?.buffer);
|
|
321
|
+
} else {
|
|
322
|
+
this.controller.loadUrl(uri, this.headers);
|
|
323
|
+
}
|
|
324
|
+
} else {
|
|
325
|
+
this.loadHtmlData()
|
|
326
|
+
}
|
|
327
|
+
if (!this.hasRegisterJavaScriptProxy) {
|
|
328
|
+
this.registerPostMessage()
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
onPageBegin() {
|
|
333
|
+
try {
|
|
334
|
+
if (this.controller.getUrl() === this.url) {
|
|
335
|
+
this.onLoadingStart();
|
|
336
|
+
}
|
|
337
|
+
this.controller.setScrollable(this.scrollEnabled)
|
|
338
|
+
this.ignoreSilentHardwareSwitchMethods(this.descriptorWrapper.rawProps.ignoreSilentHardwareSwitch)
|
|
339
|
+
} catch (error) {
|
|
340
|
+
Logger.debug(TAG,
|
|
341
|
+
`[RNOH] setignoreSilentHardwareSwitch and setScrollable ErrorCode: ${error.code}, Message: ${error.message}, userAgent: ${this.descriptorWrapper.rawProps.userAgent}`);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
getBundleName() {
|
|
346
|
+
let bundleFlags =
|
|
347
|
+
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_ABILITY |
|
|
348
|
+
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION;
|
|
349
|
+
|
|
350
|
+
try {
|
|
351
|
+
bundleManager.getBundleInfoForSelf(bundleFlags, (error, data) => {
|
|
352
|
+
if (error) {
|
|
353
|
+
Logger.error(TAG,
|
|
354
|
+
`[RNOH] getBundleInfoForSelf failed ErrorCode: ${error.code}, Message: ${error.message}`);
|
|
355
|
+
} else {
|
|
356
|
+
this.bundleName = JSON.stringify(data.name)
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
} catch (error) {
|
|
360
|
+
Logger.error(TAG,
|
|
361
|
+
`[RNOH] getBundleInfoForSelf failed ErrorCode: ${error.code}, Message: ${error.message}`);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
resourceToString(resource: Resource): string {
|
|
366
|
+
return getContext(this).resourceManager.getStringSync(resource)
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
onPageEnd() {
|
|
370
|
+
this.runInjectedJavaScript()
|
|
371
|
+
this.onLoadingFinish()
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
getPermissionDialogMessage(event: OnPermissionRequestEvent) {
|
|
375
|
+
let permissionDialogMessage = ''
|
|
376
|
+
permissionDialogMessage = event.request.getAccessibleResource().toString()
|
|
377
|
+
switch (permissionDialogMessage) {
|
|
378
|
+
case ProtectedResourceType.VIDEO_CAPTURE:
|
|
379
|
+
permissionDialogMessage = this.resourceToString($r('app.string.use_your_camera'))
|
|
380
|
+
break;
|
|
381
|
+
case ProtectedResourceType.AUDIO_CAPTURE:
|
|
382
|
+
permissionDialogMessage = this.resourceToString($r('app.string.use_your_microphone'))
|
|
383
|
+
break;
|
|
384
|
+
case ProtectedResourceType.MidiSysex:
|
|
385
|
+
permissionDialogMessage = this.resourceToString($r('app.string.midi_sysex_resources'))
|
|
386
|
+
break;
|
|
387
|
+
case ProtectedResourceType.VIDEO_CAPTURE + "," + ProtectedResourceType.AUDIO_CAPTURE:
|
|
388
|
+
permissionDialogMessage = this.resourceToString($r('app.string.use_your_camera_and_microphone'))
|
|
389
|
+
break;
|
|
390
|
+
}
|
|
391
|
+
return permissionDialogMessage;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
onLoadIntercept(event: OnLoadInterceptEvent): boolean {
|
|
395
|
+
Logger.debug(TAG, `onLoadIntercept start`)
|
|
396
|
+
this.webViewBaseOperate?.setLockIdentifier(BaseOperate.generateLockIdentifier())
|
|
397
|
+
|
|
398
|
+
const params = new ShouldStartParams();
|
|
399
|
+
params.lockIdentifier = this.webViewBaseOperate?.getLockIdentifier() || -1
|
|
400
|
+
this.ctx.runOnWorkerThread(new WorkerRunnable(), params);
|
|
401
|
+
this.webViewBaseOperate?.emitShouldStartLoadWithRequest(event)
|
|
402
|
+
const startTime = Date.now();
|
|
403
|
+
// 当lockState没变化并且小于超时时间,阻塞进程
|
|
404
|
+
while (params.lockState === ShouldOverrideCallbackState.UNDECIDED &&
|
|
405
|
+
Date.now() - startTime < RNCWebView.SHOULD_OVERRIDE_URL_LOADING_TIMEOUT) {
|
|
406
|
+
// 空循环等待
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
Logger.debug('params.lockState res:' + params.lockState + `, wait time is ${Date.now() - startTime}`);
|
|
410
|
+
return params.lockState === ShouldOverrideCallbackState.SHOULD_OVERRIDE;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
onOverrideUrlLoading(event: WebResourceRequest) {
|
|
414
|
+
this.webViewBaseOperate?.emitShouldStartLoadWithRequestOverrideUrlLoading(event)
|
|
415
|
+
return false
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
build() {
|
|
419
|
+
Stack() {
|
|
420
|
+
Web({ src: "", controller: this.controller, renderMode: this.renderMode })
|
|
421
|
+
.mixedMode(this.mode)
|
|
422
|
+
.onPermissionRequest((event: OnPermissionRequestEvent) => {
|
|
423
|
+
if (event && (this.getPermissionDialogMessage(event) != "TYPE_SENSOR")) {
|
|
424
|
+
AlertDialog.show({
|
|
425
|
+
title: this.resourceToString($r('app.string.on_confirm')) + event.request.getOrigin(),
|
|
426
|
+
message: this.getPermissionDialogMessage(event),
|
|
427
|
+
alignment: DialogAlignment.Center,
|
|
428
|
+
primaryButton: {
|
|
429
|
+
value: $r('app.string.deny'),
|
|
430
|
+
action: () => {
|
|
431
|
+
event.request.deny();
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
secondaryButton: {
|
|
435
|
+
value: $r('app.string.on_confirm'),
|
|
436
|
+
action: () => {
|
|
437
|
+
event.request.grant(event.request.getAccessibleResource());
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
cancel: () => {
|
|
441
|
+
event.request.deny();
|
|
442
|
+
}
|
|
443
|
+
})
|
|
444
|
+
}
|
|
445
|
+
})
|
|
446
|
+
|
|
447
|
+
.width(this.webviewWidth)
|
|
448
|
+
.height(this.webviewHeight)
|
|
449
|
+
.fileAccess(this.allowFileAccess)
|
|
450
|
+
.constraintSize({ minHeight: MINHEIGHT })
|
|
451
|
+
.overScrollMode(this.overScrollMode)
|
|
452
|
+
.javaScriptAccess(this.javaScriptEnable)
|
|
453
|
+
.javaScriptOnDocumentStart(this.injectedJavaScriptBeforeContentLoaded)
|
|
454
|
+
.horizontalScrollBarAccess(this.descriptorWrapper.rawProps.showsHorizontalScrollIndicator)
|
|
455
|
+
.verticalScrollBarAccess(this.descriptorWrapper.rawProps.showsVerticalScrollIndicator)
|
|
456
|
+
.overviewModeAccess(this.descriptorWrapper.rawProps.scalesPageToFit)
|
|
457
|
+
.textZoomRatio(this.descriptorWrapper.rawProps.textZoom)
|
|
458
|
+
.backgroundColor(BaseOperate.getColorMode(this.ctx.uiAbilityContext,
|
|
459
|
+
this.descriptorWrapper.rawProps.forceDarkOn) === WebDarkMode.On ? Color.White : Color.Transparent)
|
|
460
|
+
.darkMode(BaseOperate.getColorMode(this.ctx.uiAbilityContext, this.descriptorWrapper.rawProps.forceDarkOn))
|
|
461
|
+
.forceDarkAccess(this.forceDark)
|
|
462
|
+
.cacheMode(this.cacheMode)
|
|
463
|
+
.minFontSize(this.minFontSize)
|
|
464
|
+
.domStorageAccess(this.descriptorWrapper.rawProps.domStorageEnabled)
|
|
465
|
+
.zoomAccess(this.descriptorWrapper.rawProps.scalesPageToFit)
|
|
466
|
+
.overScrollMode(this.overScrollMode)
|
|
467
|
+
.onProgressChange((event: OnProgressChangeEvent) => this.onProgressChange(event))
|
|
468
|
+
.onScroll((event: OnScrollEvent) => this.webViewBaseOperate?.emitScroll(event))
|
|
469
|
+
.nestedScroll({
|
|
470
|
+
scrollForward: this.nestedScroll,
|
|
471
|
+
scrollBackward: this.nestedScroll,
|
|
472
|
+
})
|
|
473
|
+
.onLoadStarted(() => this.onPageBegin())
|
|
474
|
+
.onLoadFinished(() => this.onPageEnd())
|
|
475
|
+
.onErrorReceive((event: OnErrorReceiveEvent) => this.webViewBaseOperate?.emitLoadingError(event))
|
|
476
|
+
.onHttpErrorReceive((event: OnHttpErrorReceiveEvent) => this.webViewBaseOperate?.emitHttpError(event))
|
|
477
|
+
.onControllerAttached(() => this.controllerAttachedInit())
|
|
478
|
+
.onAlert((event: AlertEvent) => this.onJavascriptAlert(event))
|
|
479
|
+
.onConfirm((event: AlertEvent) => this.onJavascriptConfirm(event))
|
|
480
|
+
.onDownloadStart((event: OnDownloadStartEvent) => this.webViewBaseOperate?.onDownloadStart(event))
|
|
481
|
+
.geolocationAccess(this.descriptorWrapper.rawProps.geolocationEnabled)
|
|
482
|
+
.onGeolocationShow((event) => {
|
|
483
|
+
if (event && (this.descriptorWrapper.rawProps.geolocationEnabled != undefined)) {
|
|
484
|
+
event.geolocation.invoke(event.origin, this.descriptorWrapper.rawProps.geolocationEnabled, true);
|
|
485
|
+
}
|
|
486
|
+
})
|
|
487
|
+
.mediaPlayGestureAccess(this.descriptorWrapper.rawProps.mediaPlaybackRequiresUserAction)
|
|
488
|
+
.onRenderExited((event: OnRenderExitedEvent) => this.webViewBaseOperate?.onRenderExited(event))
|
|
489
|
+
.onLoadIntercept((event: OnLoadInterceptEvent) => this.onLoadIntercept(event))
|
|
490
|
+
.onTitleReceive((event: OnTitleReceiveEvent) => this.webViewBaseOperate?.onTitleReceive(event))
|
|
491
|
+
}
|
|
492
|
+
.width(this.webviewWidth)
|
|
493
|
+
.height(this.webviewHeight)
|
|
494
|
+
.position({
|
|
495
|
+
x: this.descriptorWrapper.layoutMetrics.frame.origin.x,
|
|
496
|
+
y: this.descriptorWrapper.layoutMetrics.frame.origin.y
|
|
497
|
+
})
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
private onDescriptorWrapperChange(descriptorWrapper: WebViewDescriptor) {
|
|
501
|
+
this.initVariable()
|
|
502
|
+
this.descriptorWrapper = descriptorWrapper
|
|
503
|
+
if (this.source.html != "" && this.html != this.source.html) {
|
|
504
|
+
if (this.controllerAttached) {
|
|
505
|
+
this.loadHtmlData(this.source.html, this.source.baseUrl)
|
|
506
|
+
Logger.debug(TAG, "[RNOH] html is update")
|
|
507
|
+
this.html = this.source.html
|
|
508
|
+
}
|
|
509
|
+
} else if (this.source.uri && this.source.method && this.source.method.toUpperCase() === 'POST' && this.source.body && (this.source.uri != this.url || this.body != this.source.body)) {
|
|
510
|
+
if (this.controllerAttached) {
|
|
511
|
+
let url = this.source.uri as string;
|
|
512
|
+
this.url = url;
|
|
513
|
+
this.body = this.source.body;
|
|
514
|
+
let postData = buffer.from(this.source.body);
|
|
515
|
+
this.controller.postUrl(url, postData?.buffer);
|
|
516
|
+
}
|
|
517
|
+
} else if (this.url != this.source.uri) {
|
|
518
|
+
if (this.source.uri != "") {
|
|
519
|
+
Logger.debug(TAG, `[RNOH] newDescriptor props update uri: ` + this.source.uri);
|
|
520
|
+
if (this.controllerAttached) {
|
|
521
|
+
this.controller.loadUrl(this.descriptorWrapper.rawProps.newSource.uri, this.headers)
|
|
522
|
+
}
|
|
523
|
+
} else {
|
|
524
|
+
this.loadHtmlData()
|
|
525
|
+
}
|
|
526
|
+
this.url = this.source.uri as string;
|
|
527
|
+
}
|
|
528
|
+
if (this.controllerAttached) {
|
|
529
|
+
this.controller?.setScrollable(this.descriptorWrapper.rawProps.scrollEnabled)
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
private initVariable() {
|
|
534
|
+
this.descriptorWrapper = this.ctx.descriptorRegistry.getDescriptor<WebViewDescriptor>(this.tag)
|
|
535
|
+
this.javaScriptEnable = this.descriptorWrapper.rawProps.javaScriptEnabled;
|
|
536
|
+
this.minFontSize =
|
|
537
|
+
this.descriptorWrapper.rawProps.minimumFontSize ? this.descriptorWrapper.rawProps.minimumFontSize : EIGHT;
|
|
538
|
+
this.cacheMode =
|
|
539
|
+
this.descriptorWrapper.rawProps.cacheEnabled ?
|
|
540
|
+
this.webViewBaseOperate?.transCacheMode(this.descriptorWrapper.rawProps.cacheMode as CACHE_MODE) as number :
|
|
541
|
+
CacheMode.Online;
|
|
542
|
+
this.source = {
|
|
543
|
+
uri: this.descriptorWrapper.rawProps.newSource.uri ?? "",
|
|
544
|
+
method: this.descriptorWrapper.rawProps.newSource.method ?? "",
|
|
545
|
+
body: this.descriptorWrapper.rawProps.newSource.body ?? "",
|
|
546
|
+
html: this.descriptorWrapper.rawProps.newSource.html ?? "",
|
|
547
|
+
baseUrl: this.descriptorWrapper.rawProps.newSource.baseUrl ?? "",
|
|
548
|
+
headers: this.descriptorWrapper.rawProps.newSource.headers ?? []
|
|
549
|
+
}
|
|
550
|
+
if (this.source.headers) {
|
|
551
|
+
this.source.headers.forEach(item => {
|
|
552
|
+
if (item.name && item.value) {
|
|
553
|
+
this.headers.push({ headerKey: item.name, headerValue: item.value })
|
|
554
|
+
}
|
|
555
|
+
})
|
|
556
|
+
}
|
|
557
|
+
// this.html = this.source.html
|
|
558
|
+
this.webviewWidth = this.descriptorWrapper.layoutMetrics.frame.size.width
|
|
559
|
+
this.webviewHeight = this.descriptorWrapper.layoutMetrics.frame.size.height
|
|
560
|
+
this.scrollEnabled = this.descriptorWrapper.rawProps.scrollEnabled;
|
|
561
|
+
// 当禁止滚动时,使用父组件滚动
|
|
562
|
+
this.nestedScroll = this.scrollEnabled ? NestedScrollMode.SELF_FIRST : NestedScrollMode.PARENT_FIRST;
|
|
563
|
+
if (this.source.uri && this.source.uri.toString().startsWith("asset://")) {
|
|
564
|
+
this.source.uri = $rawfile(this.source.uri.toString().replace("asset://", this.ctx.rnInstance.getAssetsDest()));
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
if (this.descriptorWrapper.rawProps.overScrollMode === WebViewOverScrollMode.ALWAYS) {
|
|
568
|
+
this.overScrollMode = OverScrollMode.ALWAYS
|
|
569
|
+
} else if (this.descriptorWrapper.rawProps.overScrollMode === WebViewOverScrollMode.NEVER) {
|
|
570
|
+
this.overScrollMode = OverScrollMode.NEVER
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
this.overScrollMode = this.descriptorWrapper.rawProps.bounces ? OverScrollMode.ALWAYS : OverScrollMode.NEVER;
|
|
574
|
+
|
|
575
|
+
if (this.descriptorWrapper.rawProps.injectedJavaScriptBeforeContentLoaded) {
|
|
576
|
+
this.injectedJavaScriptBeforeContentLoaded = [
|
|
577
|
+
{ script: this.descriptorWrapper.rawProps.injectedJavaScriptBeforeContentLoaded, scriptRules: ["*"] }
|
|
578
|
+
];
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
private registerPostMessage() {
|
|
583
|
+
if (this.messagingEnabled == this.descriptorWrapper.rawProps.messagingEnabled) {
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
this.messagingEnabled = this.descriptorWrapper.rawProps.messagingEnabled;
|
|
587
|
+
if (this.messagingEnabled) {
|
|
588
|
+
let bridge: RNCWebViewBridge = {
|
|
589
|
+
postMessage: (data: string) => {
|
|
590
|
+
Logger.debug(TAG, `[RNOH] bridge postMessage, ${JSON.stringify(data)}`);
|
|
591
|
+
if (this.controller != null) {
|
|
592
|
+
let result: WebViewEventParams = this.createWebViewEvent("onMessage")
|
|
593
|
+
if (result) {
|
|
594
|
+
result.data = data.toString()
|
|
595
|
+
result.lockIdentifier = this.webViewBaseOperate?.getLockIdentifier()
|
|
596
|
+
this.eventEmitter!.emit("message", result as ResultType);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
this.controller.registerJavaScriptProxy(bridge, JAVASCRIPT_INTERFACE, ["postMessage"])
|
|
602
|
+
this.source.uri ?
|
|
603
|
+
this.controller.loadUrl(this.source.uri, this.headers) : this.controller.refresh()
|
|
604
|
+
this.hasRegisterJavaScriptProxy = true
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
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 type {
|
|
26
|
+
DescriptorWrapperFactoryByDescriptorType,
|
|
27
|
+
DescriptorWrapperFactoryByDescriptorTypeCtx,
|
|
28
|
+
} from '@rnoh/react-native-openharmony/ts';
|
|
29
|
+
import { RNC, TM } from './generated/ts';
|
|
30
|
+
import { AnyThreadTurboModuleFactory, AnyThreadTurboModule } from '@rnoh/react-native-openharmony/ts';
|
|
31
|
+
import { RNOHPackage, ComponentBuilderContext } from '@rnoh/react-native-openharmony';
|
|
32
|
+
import { WebViewTurboModule } from './WebViewTurboModule'
|
|
33
|
+
import { WorkerTurboModuleContext } from '@rnoh/react-native-openharmony/src/main/ets/RNOH/RNOHContext';
|
|
34
|
+
import { RNCWebView } from './RNCWebView';
|
|
35
|
+
@Builder
|
|
36
|
+
function buildWebView(ctx: ComponentBuilderContext) {
|
|
37
|
+
RNCWebView({ ctx: ctx.rnComponentContext, tag: ctx.tag, })
|
|
38
|
+
}
|
|
39
|
+
export class RNCWebViewPackage extends RNOHPackage {
|
|
40
|
+
createDescriptorWrapperFactoryByDescriptorType(ctx: DescriptorWrapperFactoryByDescriptorTypeCtx): DescriptorWrapperFactoryByDescriptorType {
|
|
41
|
+
return {
|
|
42
|
+
"RNCWebView": (ctx) => new RNC.RNCWebView.DescriptorWrapper(ctx.descriptor)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
createAnyThreadTurboModuleFactory(ctx: WorkerTurboModuleContext): AnyThreadTurboModuleFactory {
|
|
47
|
+
return new WebViewTurboModulesFactory(ctx);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
createWrappedCustomRNComponentBuilderByComponentNameMap(): Map<string, WrappedBuilder<[ComponentBuilderContext]>> {
|
|
51
|
+
return new Map().set(RNCWebView.NAME, wrapBuilder(buildWebView))
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
class WebViewTurboModulesFactory extends AnyThreadTurboModuleFactory {
|
|
56
|
+
createTurboModule(name: string): AnyThreadTurboModule | null {
|
|
57
|
+
if (name === TM.RNCWebViewModule.NAME) {
|
|
58
|
+
return new WebViewTurboModule(this.ctx);
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
hasTurboModule(name: string): boolean {
|
|
64
|
+
return name === TM.RNCWebViewModule.NAME;
|
|
65
|
+
}
|
|
66
|
+
}
|