@react-native-ohos/react-native-webview 13.10.5-rc.2 → 13.15.1-rc.3
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 +1 -1
- package/README.OpenSource +11 -0
- package/README.md +2 -2
- package/harmony/rn_webview/index.ets +4 -25
- package/harmony/rn_webview/oh-package.json5 +2 -2
- package/harmony/rn_webview/src/main/cpp/WebViewPackage.h +4 -24
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/BaseReactNativeWebviewPackage.h +69 -69
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/components/RNCWebViewJSIBinder.h +109 -116
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebView.cpp +1 -3
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebViewModule.cpp +1 -3
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ComponentDescriptors.h +7 -5
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/EventEmitters.cpp +231 -230
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/EventEmitters.h +250 -272
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/Props.cpp +62 -110
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/Props.h +494 -322
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ShadowNodes.cpp +4 -6
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ShadowNodes.h +7 -9
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/States.cpp +5 -5
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/States.h +14 -5
- package/harmony/rn_webview/src/main/ets/CutomReference.ts +3 -23
- package/harmony/rn_webview/src/main/ets/Logger.ts +3 -23
- package/harmony/rn_webview/src/main/ets/Magic.ets +3 -24
- package/harmony/rn_webview/src/main/ets/RNCWebView.ets +7 -81
- package/harmony/rn_webview/src/main/ets/RNCWebViewPackage.ets +5 -33
- package/harmony/rn_webview/src/main/ets/ShouldRequestUrl.ts +3 -23
- package/harmony/rn_webview/src/main/ets/WebViewBaseOperate.ets +3 -23
- package/harmony/rn_webview/src/main/ets/WebViewTurboModule.ets +3 -23
- package/harmony/rn_webview/src/main/ets/generated/components/RNCWebView.ts +47 -32
- package/harmony/rn_webview/ts.ets +3 -23
- package/harmony/rn_webview.har +0 -0
- package/package.json +11 -16
- package/src/NativeRNCWebView.ts +6 -0
- package/src/NativeRNCWebViewModule.ts +5 -3
- package/src/RNCWebViewNativeComponent.ts +158 -90
- package/src/WebView.harmony.tsx +17 -4
- package/src/WebView.tsx +6 -0
- package/src/codegenUtils.ts +5 -3
- package/src/index.ts +6 -0
- package/harmony/rn_webview/BuildProfile.ets +0 -41
- package/harmony/rn_webview/LICENSE +0 -21
- package/harmony/rn_webview/NOTICE +0 -33
- package/harmony/rn_webview/README.OpenSource +0 -11
- package/harmony/rn_webview/consumer-rules.txt +0 -0
- package/harmony/rn_webview/obfuscation-rules.txt +0 -18
|
@@ -8,12 +8,10 @@
|
|
|
8
8
|
* @generated by codegen project: GenerateShadowNodeCpp.js
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
#include
|
|
11
|
+
#include "ShadowNodes.h"
|
|
12
12
|
|
|
13
|
-
namespace facebook {
|
|
14
|
-
namespace react {
|
|
13
|
+
namespace facebook::react {
|
|
15
14
|
|
|
16
|
-
const char
|
|
15
|
+
extern const char RNCWebViewComponentName[] = "RNCWebView";
|
|
17
16
|
|
|
18
|
-
} // namespace react
|
|
19
|
-
} // namespace facebook
|
|
17
|
+
} // namespace facebook::react
|
|
@@ -10,25 +10,23 @@
|
|
|
10
10
|
|
|
11
11
|
#pragma once
|
|
12
12
|
|
|
13
|
-
#include
|
|
14
|
-
#include
|
|
15
|
-
#include
|
|
13
|
+
#include "EventEmitters.h"
|
|
14
|
+
#include "Props.h"
|
|
15
|
+
#include "States.h"
|
|
16
16
|
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
17
17
|
#include <jsi/jsi.h>
|
|
18
18
|
|
|
19
|
-
namespace facebook {
|
|
20
|
-
namespace react {
|
|
19
|
+
namespace facebook::react {
|
|
21
20
|
|
|
22
|
-
JSI_EXPORT extern const char
|
|
21
|
+
JSI_EXPORT extern const char RNCWebViewComponentName[];
|
|
23
22
|
|
|
24
23
|
/*
|
|
25
24
|
* `ShadowNode` for <RNCWebView> component.
|
|
26
25
|
*/
|
|
27
26
|
using RNCWebViewShadowNode = ConcreteViewShadowNode<
|
|
28
|
-
|
|
27
|
+
RNCWebViewComponentName,
|
|
29
28
|
RNCWebViewProps,
|
|
30
29
|
RNCWebViewEventEmitter,
|
|
31
30
|
RNCWebViewState>;
|
|
32
31
|
|
|
33
|
-
} // namespace react
|
|
34
|
-
} // namespace facebook
|
|
32
|
+
} // namespace facebook::react
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @generated by codegen project: GenerateStateCpp.js
|
|
9
9
|
*/
|
|
10
|
-
#include
|
|
10
|
+
#include "States.h"
|
|
11
11
|
|
|
12
|
-
namespace facebook {
|
|
13
|
-
namespace react {
|
|
12
|
+
namespace facebook::react {
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
} // namespace facebook::react
|
|
@@ -8,13 +8,22 @@
|
|
|
8
8
|
*/
|
|
9
9
|
#pragma once
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
#ifdef ANDROID
|
|
12
|
+
#include <folly/dynamic.h>
|
|
13
|
+
#endif
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
13
16
|
|
|
14
17
|
class RNCWebViewState {
|
|
15
18
|
public:
|
|
16
|
-
|
|
19
|
+
RNCWebViewState() = default;
|
|
20
|
+
|
|
21
|
+
#ifdef ANDROID
|
|
22
|
+
RNCWebViewState(RNCWebViewState const &previousState, folly::dynamic data){};
|
|
23
|
+
folly::dynamic getDynamic() const {
|
|
24
|
+
return {};
|
|
25
|
+
};
|
|
26
|
+
#endif
|
|
17
27
|
};
|
|
18
28
|
|
|
19
|
-
} // namespace react
|
|
20
|
-
} // namespace facebook
|
|
29
|
+
} // namespace facebook::react
|
|
@@ -1,26 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
*/
|
|
1
|
+
// Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
2
|
+
// Use of this source code is governed by a Apache-2.0 license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
24
4
|
|
|
25
5
|
export class CustomReference {
|
|
26
6
|
private atomicValue: number;
|
|
@@ -1,26 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
*/
|
|
1
|
+
// Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
2
|
+
// Use of this source code is governed by a Apache-2.0 license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
24
4
|
|
|
25
5
|
import hilog from '@ohos.hilog';
|
|
26
6
|
|
|
@@ -1,26 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
*/
|
|
1
|
+
// Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
2
|
+
// Use of this source code is governed by a Apache-2.0 license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
24
4
|
|
|
25
5
|
import { Descriptor, ViewBaseProps, ViewDescriptorWrapperBase, ViewRawProps } from '@rnoh/react-native-openharmony'
|
|
26
6
|
|
|
@@ -84,7 +64,6 @@ export interface WebViewProps extends ViewRawProps {
|
|
|
84
64
|
geolocationEnabled: boolean
|
|
85
65
|
applicationNameForUserAgent: string
|
|
86
66
|
pullToRefreshEnabled: boolean
|
|
87
|
-
schemeList: Array<string>
|
|
88
67
|
}
|
|
89
68
|
|
|
90
69
|
|
|
@@ -1,26 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
*/
|
|
1
|
+
// Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
2
|
+
// Use of this source code is governed by a Apache-2.0 license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
24
4
|
|
|
25
5
|
import { RNComponentContext } from '@rnoh/react-native-openharmony';
|
|
26
6
|
import webview from '@ohos.web.webview';
|
|
@@ -78,7 +58,6 @@ export struct RNCWebView {
|
|
|
78
58
|
url: string | Resource = "";
|
|
79
59
|
body: string | undefined = "";
|
|
80
60
|
controller: webview.WebviewController = new webview.WebviewController();
|
|
81
|
-
schemeHandler: webview.WebSchemeHandler = new webview.WebSchemeHandler();
|
|
82
61
|
javaScriptEnable: boolean = true;
|
|
83
62
|
allowFileAccess: boolean = true;
|
|
84
63
|
forceDark: boolean = true;
|
|
@@ -294,25 +273,6 @@ export struct RNCWebView {
|
|
|
294
273
|
this.webViewBaseOperate.setCustomUserAgent(this.descriptorWrapper.rawProps.userAgent,
|
|
295
274
|
this.descriptorWrapper.rawProps.applicationNameForUserAgent)
|
|
296
275
|
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
|
-
if (!this.hasRegisterJavaScriptProxy && this.descriptorWrapper.rawProps.messagingEnabled) {
|
|
313
|
-
this.registerJavaScriptProxyOnly()
|
|
314
|
-
}
|
|
315
|
-
|
|
316
276
|
let baseUrl = this.source.baseUrl
|
|
317
277
|
let uri = this.source.uri
|
|
318
278
|
if (this.source.html != undefined && this.source.html != "") {
|
|
@@ -474,8 +434,8 @@ export struct RNCWebView {
|
|
|
474
434
|
scrollForward: this.nestedScroll,
|
|
475
435
|
scrollBackward: this.nestedScroll,
|
|
476
436
|
})
|
|
477
|
-
.
|
|
478
|
-
.
|
|
437
|
+
.onPageBegin(() => this.onPageBegin())
|
|
438
|
+
.onPageEnd(() => this.onPageEnd())
|
|
479
439
|
.onErrorReceive((event: OnErrorReceiveEvent) => this.webViewBaseOperate?.emitLoadingError(event))
|
|
480
440
|
.onHttpErrorReceive((event: OnHttpErrorReceiveEvent) => this.webViewBaseOperate?.emitHttpError(event))
|
|
481
441
|
.onControllerAttached(() => this.controllerAttachedInit())
|
|
@@ -583,41 +543,12 @@ export struct RNCWebView {
|
|
|
583
543
|
}
|
|
584
544
|
}
|
|
585
545
|
|
|
586
|
-
private registerJavaScriptProxyOnly() {
|
|
587
|
-
if (this.messagingEnabled == this.descriptorWrapper.rawProps.messagingEnabled && this.hasRegisterJavaScriptProxy) {
|
|
588
|
-
return;
|
|
589
|
-
}
|
|
590
|
-
this.messagingEnabled = this.descriptorWrapper.rawProps.messagingEnabled;
|
|
591
|
-
if (this.messagingEnabled) {
|
|
592
|
-
let bridge: RNCWebViewBridge = {
|
|
593
|
-
postMessage: (data: string) => {
|
|
594
|
-
Logger.debug(TAG, `[RNOH] bridge postMessage, ${JSON.stringify(data)}`);
|
|
595
|
-
if (this.controller != null) {
|
|
596
|
-
let result: WebViewEventParams = this.createWebViewEvent("onMessage")
|
|
597
|
-
if (result) {
|
|
598
|
-
result.data = data.toString()
|
|
599
|
-
result.lockIdentifier = this.webViewBaseOperate?.getLockIdentifier()
|
|
600
|
-
this.eventEmitter!.emit("message", result as ResultType);
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
};
|
|
605
|
-
this.controller.registerJavaScriptProxy(bridge, JAVASCRIPT_INTERFACE, ["postMessage"])
|
|
606
|
-
this.hasRegisterJavaScriptProxy = true
|
|
607
|
-
Logger.debug(TAG, "[RNOH] JavaScript Proxy registered without reloading page")
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
|
|
611
546
|
private registerPostMessage() {
|
|
612
547
|
if (this.messagingEnabled == this.descriptorWrapper.rawProps.messagingEnabled) {
|
|
613
548
|
return;
|
|
614
549
|
}
|
|
615
550
|
this.messagingEnabled = this.descriptorWrapper.rawProps.messagingEnabled;
|
|
616
551
|
if (this.messagingEnabled) {
|
|
617
|
-
if (this.hasRegisterJavaScriptProxy) {
|
|
618
|
-
Logger.debug(TAG, "[RNOH] JavaScript Proxy already registered")
|
|
619
|
-
return
|
|
620
|
-
}
|
|
621
552
|
let bridge: RNCWebViewBridge = {
|
|
622
553
|
postMessage: (data: string) => {
|
|
623
554
|
Logger.debug(TAG, `[RNOH] bridge postMessage, ${JSON.stringify(data)}`);
|
|
@@ -632,13 +563,8 @@ export struct RNCWebView {
|
|
|
632
563
|
}
|
|
633
564
|
};
|
|
634
565
|
this.controller.registerJavaScriptProxy(bridge, JAVASCRIPT_INTERFACE, ["postMessage"])
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
} else if (this.source.html) {
|
|
638
|
-
Logger.debug(TAG, "[RNOH] JavaScript Proxy registered, HTML content will use it on next load")
|
|
639
|
-
} else {
|
|
640
|
-
this.controller.refresh()
|
|
641
|
-
}
|
|
566
|
+
this.source.uri ?
|
|
567
|
+
this.controller.loadUrl(this.source.uri, this.headers) : this.controller.refresh()
|
|
642
568
|
this.hasRegisterJavaScriptProxy = true
|
|
643
569
|
}
|
|
644
570
|
}
|
|
@@ -1,26 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
*/
|
|
1
|
+
// Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
2
|
+
// Use of this source code is governed by a Apache-2.0 license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
24
4
|
|
|
25
5
|
import type {
|
|
26
6
|
DescriptorWrapperFactoryByDescriptorType,
|
|
@@ -28,14 +8,10 @@ import type {
|
|
|
28
8
|
} from '@rnoh/react-native-openharmony/ts';
|
|
29
9
|
import { RNC, TM } from './generated/ts';
|
|
30
10
|
import { AnyThreadTurboModuleFactory, AnyThreadTurboModule } from '@rnoh/react-native-openharmony/ts';
|
|
31
|
-
import { RNOHPackage
|
|
11
|
+
import { RNOHPackage } from '@rnoh/react-native-openharmony';
|
|
32
12
|
import { WebViewTurboModule } from './WebViewTurboModule'
|
|
33
13
|
import { WorkerTurboModuleContext } from '@rnoh/react-native-openharmony/src/main/ets/RNOH/RNOHContext';
|
|
34
|
-
|
|
35
|
-
@Builder
|
|
36
|
-
function buildWebView(ctx: ComponentBuilderContext) {
|
|
37
|
-
RNCWebView({ ctx: ctx.rnComponentContext, tag: ctx.tag, })
|
|
38
|
-
}
|
|
14
|
+
|
|
39
15
|
export class RNCWebViewPackage extends RNOHPackage {
|
|
40
16
|
createDescriptorWrapperFactoryByDescriptorType(ctx: DescriptorWrapperFactoryByDescriptorTypeCtx): DescriptorWrapperFactoryByDescriptorType {
|
|
41
17
|
return {
|
|
@@ -46,10 +22,6 @@ export class RNCWebViewPackage extends RNOHPackage {
|
|
|
46
22
|
createAnyThreadTurboModuleFactory(ctx: WorkerTurboModuleContext): AnyThreadTurboModuleFactory {
|
|
47
23
|
return new WebViewTurboModulesFactory(ctx);
|
|
48
24
|
}
|
|
49
|
-
|
|
50
|
-
createWrappedCustomRNComponentBuilderByComponentNameMap(): Map<string, WrappedBuilder<[ComponentBuilderContext]>> {
|
|
51
|
-
return new Map().set(RNCWebView.NAME, wrapBuilder(buildWebView))
|
|
52
|
-
}
|
|
53
25
|
}
|
|
54
26
|
|
|
55
27
|
class WebViewTurboModulesFactory extends AnyThreadTurboModuleFactory {
|
|
@@ -1,26 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
*/
|
|
1
|
+
// Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
2
|
+
// Use of this source code is governed by a Apache-2.0 license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
24
4
|
|
|
25
5
|
import { CustomReference } from './CutomReference';
|
|
26
6
|
import HashMap from '@ohos.util.HashMap';
|
|
@@ -1,26 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
*/
|
|
1
|
+
// Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
2
|
+
// Use of this source code is governed by a Apache-2.0 license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
24
4
|
|
|
25
5
|
import { RNC } from './generated/ts'
|
|
26
6
|
import { webview } from '@kit.ArkWeb'
|
|
@@ -1,26 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
*/
|
|
1
|
+
// Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
2
|
+
// Use of this source code is governed by a Apache-2.0 license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
24
4
|
|
|
25
5
|
import { TM } from './generated/ts';
|
|
26
6
|
import { AnyThreadTurboModule } from '@rnoh/react-native-openharmony/ts';
|