@react-native-ohos/react-native-webview 13.15.1-rc.5 → 13.15.1-rc.7
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.
|
@@ -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.15.1-rc.
|
|
9
|
+
"version": "13.15.1-rc.7",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@rnoh/react-native-openharmony": "../react_native_openharmony.har"
|
|
12
12
|
}
|
|
@@ -8,7 +8,7 @@ import { url as OSUrl } from '@kit.ArkTS';
|
|
|
8
8
|
import { RNC, TM } from './generated';
|
|
9
9
|
import Logger from './Logger';
|
|
10
10
|
import { BaseOperate } from './WebViewBaseOperate';
|
|
11
|
-
import { deviceInfo } from '@kit.BasicServicesKit';
|
|
11
|
+
import { deviceInfo ,BusinessError} from '@kit.BasicServicesKit';
|
|
12
12
|
import {
|
|
13
13
|
AlertEvent,
|
|
14
14
|
CACHE_MODE,
|
|
@@ -39,6 +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
|
+
params.lockState = ShouldOverrideCallbackState.UNDECIDED
|
|
42
43
|
rnInstance.getTurboModule<WebViewTurboModule>(TM.RNCWebViewModule.NAME).setShouldStartParams(params)
|
|
43
44
|
}
|
|
44
45
|
}
|
|
@@ -338,6 +339,14 @@ export struct RNCWebView {
|
|
|
338
339
|
return getContext(this).resourceManager.getStringSync(resource)
|
|
339
340
|
}
|
|
340
341
|
|
|
342
|
+
onLoadFinished() {
|
|
343
|
+
this.onLoadingFinish()
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
onPageEndExecuteRunInjectedJavaScript(){
|
|
347
|
+
this.runInjectedJavaScript()
|
|
348
|
+
}
|
|
349
|
+
|
|
341
350
|
onPageEnd() {
|
|
342
351
|
this.runInjectedJavaScript()
|
|
343
352
|
this.onLoadingFinish()
|
|
@@ -443,7 +452,8 @@ export struct RNCWebView {
|
|
|
443
452
|
scrollBackward: this.nestedScroll,
|
|
444
453
|
})
|
|
445
454
|
.onLoadStarted(() => this.onPageBegin())
|
|
446
|
-
.onLoadFinished(() => this.
|
|
455
|
+
.onLoadFinished(() => this.onLoadFinished())
|
|
456
|
+
.onPageEnd(() => {this.onPageEndExecuteRunInjectedJavaScript()})
|
|
447
457
|
.onErrorReceive((event: OnErrorReceiveEvent) => this.webViewBaseOperate?.emitLoadingError(event))
|
|
448
458
|
.onHttpErrorReceive((event: OnHttpErrorReceiveEvent) => this.webViewBaseOperate?.emitHttpError(event))
|
|
449
459
|
.onControllerAttached(() => this.controllerAttachedInit())
|
|
@@ -36,7 +36,7 @@ export class WebViewTurboModule extends AnyThreadTurboModule implements TM.RNCWe
|
|
|
36
36
|
// 锁状态
|
|
37
37
|
export enum ShouldOverrideCallbackState {
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* 等待返回状态
|
|
40
40
|
*/
|
|
41
41
|
UNDECIDED,
|
|
42
42
|
/**
|
|
@@ -47,6 +47,11 @@ export enum ShouldOverrideCallbackState {
|
|
|
47
47
|
* 允许加载
|
|
48
48
|
*/
|
|
49
49
|
ALLOW_LOADING,
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* 允许加载
|
|
53
|
+
*/
|
|
54
|
+
DEFAULT,
|
|
50
55
|
}
|
|
51
56
|
|
|
52
57
|
@Sendable
|
|
@@ -54,5 +59,5 @@ export class ShouldStartParams {
|
|
|
54
59
|
shouldStart: boolean = true
|
|
55
60
|
lockIdentifier: number = -1
|
|
56
61
|
// 对应ShouldOverrideCallbackState
|
|
57
|
-
lockState: number =
|
|
62
|
+
lockState: number = ShouldOverrideCallbackState.DEFAULT
|
|
58
63
|
}
|
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.15.1-rc.
|
|
12
|
+
"version": "13.15.1-rc.7",
|
|
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",
|