@react-native-ohos/react-native-webview 13.10.6-beta.3 → 13.10.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.
- package/CHANGELOG.md +16 -0
- package/LICENSE +21 -21
- package/README.md +385 -393
- package/harmony/rn_webview/.gitignore +6 -0
- package/harmony/rn_webview/BuildProfile.ets +1 -1
- package/harmony/rn_webview/LICENSE +21 -21
- package/harmony/rn_webview/NOTICE +33 -33
- package/harmony/rn_webview/OAT.xml +44 -44
- package/harmony/rn_webview/README.OpenSource +10 -10
- package/harmony/rn_webview/build-profile.json5 +28 -28
- package/harmony/rn_webview/index.ets +33 -33
- package/harmony/rn_webview/obfuscation-rules.txt +17 -17
- package/harmony/rn_webview/oh-package-lock.json5 +18 -18
- package/harmony/rn_webview/oh-package.json5 +13 -13
- package/harmony/rn_webview/src/main/cpp/CMakeLists.txt +9 -9
- package/harmony/rn_webview/src/main/cpp/WebViewPackage.h +36 -36
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/BaseReactNativeWebviewPackage.h +94 -94
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/components/RNCWebViewJSIBinder.h +129 -128
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebView.cpp +20 -20
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebView.h +16 -16
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebViewModule.cpp +19 -19
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebViewModule.h +16 -16
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ComponentDescriptors.h +22 -22
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/EventEmitters.cpp +240 -240
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/EventEmitters.h +285 -285
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/Props.cpp +156 -155
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/Props.h +340 -339
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ShadowNodes.cpp +19 -19
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ShadowNodes.h +34 -34
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/States.cpp +16 -16
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/States.h +19 -19
- package/harmony/rn_webview/src/main/ets/CutomReference.ts +49 -49
- package/harmony/rn_webview/src/main/ets/Logger.ts +63 -63
- package/harmony/rn_webview/src/main/ets/Magic.ets +223 -221
- package/harmony/rn_webview/src/main/ets/RNCWebView.ets +1098 -903
- package/harmony/rn_webview/src/main/ets/RNCWebViewPackage.ets +65 -65
- package/harmony/rn_webview/src/main/ets/ShouldRequestUrl.ts +67 -67
- package/harmony/rn_webview/src/main/ets/WebViewBaseOperate.ets +490 -490
- package/harmony/rn_webview/src/main/ets/WebViewTurboModule.ets +81 -81
- package/harmony/rn_webview/src/main/ets/generated/components/RNCWebView.ts +516 -511
- package/harmony/rn_webview/src/main/ets/generated/components/ts.ts +5 -5
- package/harmony/rn_webview/src/main/ets/generated/index.ets +5 -5
- package/harmony/rn_webview/src/main/ets/generated/ts.ts +6 -6
- package/harmony/rn_webview/src/main/ets/generated/turboModules/RNCWebView.ts +18 -18
- package/harmony/rn_webview/src/main/ets/generated/turboModules/RNCWebViewModule.ts +16 -16
- package/harmony/rn_webview/src/main/ets/generated/turboModules/ts.ts +6 -6
- package/harmony/rn_webview/src/main/module.json5 +10 -10
- package/harmony/rn_webview/src/main/resources/base/element/string.json +39 -39
- package/harmony/rn_webview/src/main/resources/en_US/element/string.json +39 -39
- package/harmony/rn_webview/src/main/resources/zh_CN/element/string.json +39 -39
- package/harmony/rn_webview/src/test/List.test.ets +4 -4
- package/harmony/rn_webview/src/test/LocalUnit.test.ets +32 -32
- package/harmony/rn_webview/ts.ets +28 -28
- package/harmony/rn_webview.har +0 -0
- package/package.json +105 -104
- package/src/NativeRNCWebView.ts +15 -15
- package/src/NativeRNCWebViewModule.ts +17 -17
- package/src/RNCWebViewNativeComponent.ts +289 -288
- package/src/WebView.harmony.tsx +331 -331
- package/src/WebView.tsx +4 -4
- package/src/codegenUtils.ts +8 -8
- package/src/index.ts +4 -4
|
@@ -1,66 +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
|
-
}
|
|
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
66
|
}
|
|
@@ -1,68 +1,68 @@
|
|
|
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 { CustomReference } from './CutomReference';
|
|
26
|
-
import HashMap from '@ohos.util.HashMap';
|
|
27
|
-
|
|
28
|
-
export enum CallbackState {
|
|
29
|
-
UNDECIDED,
|
|
30
|
-
SHOULD_OVERRIDE,
|
|
31
|
-
DO_NOT_OVERRIDE,
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export class ShouldRequestUrl {
|
|
35
|
-
private constructor() {
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
static nextLockIdentifier: number = 1;
|
|
39
|
-
static ShouldRequestUrlLocks: HashMap<string, CustomReference> = new HashMap();
|
|
40
|
-
static callBack: Function;
|
|
41
|
-
|
|
42
|
-
static setCallBack(lockIdentifier: string, callBack: Function): void {
|
|
43
|
-
let data: CustomReference = ShouldRequestUrl.ShouldRequestUrlLocks.get(lockIdentifier);
|
|
44
|
-
data.setCallBack(callBack)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public static getNewData(): string {
|
|
48
|
-
let lockIdentifier = ShouldRequestUrl.nextLockIdentifier++ + ''
|
|
49
|
-
let custom = new CustomReference(CallbackState.UNDECIDED)
|
|
50
|
-
ShouldRequestUrl.ShouldRequestUrlLocks.set(lockIdentifier, custom)
|
|
51
|
-
return lockIdentifier
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public static setValue(lockIdentifier: number, stateParam: CallbackState): void {
|
|
55
|
-
let lock: string = lockIdentifier + '';
|
|
56
|
-
if (ShouldRequestUrl.ShouldRequestUrlLocks.hasKey(lock)) {
|
|
57
|
-
let data: CustomReference = ShouldRequestUrl.ShouldRequestUrlLocks.get(lock)
|
|
58
|
-
data.setValue(stateParam)
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
public static getValue(lockIdentifier: string): CallbackState {
|
|
63
|
-
return ShouldRequestUrl.ShouldRequestUrlLocks.get(lockIdentifier).getValue()
|
|
64
|
-
}
|
|
65
|
-
public static removeData(lockIdentifier: string): void {
|
|
66
|
-
ShouldRequestUrl.ShouldRequestUrlLocks.remove(lockIdentifier)
|
|
67
|
-
}
|
|
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 { CustomReference } from './CutomReference';
|
|
26
|
+
import HashMap from '@ohos.util.HashMap';
|
|
27
|
+
|
|
28
|
+
export enum CallbackState {
|
|
29
|
+
UNDECIDED,
|
|
30
|
+
SHOULD_OVERRIDE,
|
|
31
|
+
DO_NOT_OVERRIDE,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class ShouldRequestUrl {
|
|
35
|
+
private constructor() {
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static nextLockIdentifier: number = 1;
|
|
39
|
+
static ShouldRequestUrlLocks: HashMap<string, CustomReference> = new HashMap();
|
|
40
|
+
static callBack: Function;
|
|
41
|
+
|
|
42
|
+
static setCallBack(lockIdentifier: string, callBack: Function): void {
|
|
43
|
+
let data: CustomReference = ShouldRequestUrl.ShouldRequestUrlLocks.get(lockIdentifier);
|
|
44
|
+
data.setCallBack(callBack)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public static getNewData(): string {
|
|
48
|
+
let lockIdentifier = ShouldRequestUrl.nextLockIdentifier++ + ''
|
|
49
|
+
let custom = new CustomReference(CallbackState.UNDECIDED)
|
|
50
|
+
ShouldRequestUrl.ShouldRequestUrlLocks.set(lockIdentifier, custom)
|
|
51
|
+
return lockIdentifier
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public static setValue(lockIdentifier: number, stateParam: CallbackState): void {
|
|
55
|
+
let lock: string = lockIdentifier + '';
|
|
56
|
+
if (ShouldRequestUrl.ShouldRequestUrlLocks.hasKey(lock)) {
|
|
57
|
+
let data: CustomReference = ShouldRequestUrl.ShouldRequestUrlLocks.get(lock)
|
|
58
|
+
data.setValue(stateParam)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public static getValue(lockIdentifier: string): CallbackState {
|
|
63
|
+
return ShouldRequestUrl.ShouldRequestUrlLocks.get(lockIdentifier).getValue()
|
|
64
|
+
}
|
|
65
|
+
public static removeData(lockIdentifier: string): void {
|
|
66
|
+
ShouldRequestUrl.ShouldRequestUrlLocks.remove(lockIdentifier)
|
|
67
|
+
}
|
|
68
68
|
}
|