@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.
Files changed (61) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +13 -0
  3. package/harmony/rn_webview/BuildProfile.ets +41 -0
  4. package/harmony/rn_webview/LICENSE +21 -0
  5. package/harmony/rn_webview/NOTICE +33 -0
  6. package/harmony/rn_webview/OAT.xml +45 -0
  7. package/harmony/rn_webview/README.OpenSource +11 -0
  8. package/harmony/rn_webview/build-profile.json5 +28 -0
  9. package/harmony/rn_webview/consumer-rules.txt +0 -0
  10. package/harmony/rn_webview/hvigorfile.ts +1 -0
  11. package/harmony/rn_webview/index.ets +34 -0
  12. package/harmony/rn_webview/obfuscation-rules.txt +18 -0
  13. package/harmony/rn_webview/oh-package.json5 +13 -0
  14. package/harmony/rn_webview/src/main/cpp/CMakeLists.txt +9 -0
  15. package/harmony/rn_webview/src/main/cpp/WebViewPackage.h +37 -0
  16. package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/BaseReactNativeWebviewPackage.h +95 -0
  17. package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/components/RNCWebViewJSIBinder.h +126 -0
  18. package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebView.cpp +20 -0
  19. package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebView.h +16 -0
  20. package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebViewModule.cpp +19 -0
  21. package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebViewModule.h +16 -0
  22. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ComponentDescriptors.h +22 -0
  23. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/EventEmitters.cpp +240 -0
  24. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/EventEmitters.h +285 -0
  25. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/Props.cpp +151 -0
  26. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/Props.h +337 -0
  27. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ShadowNodes.cpp +19 -0
  28. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ShadowNodes.h +34 -0
  29. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/States.cpp +16 -0
  30. package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/States.h +20 -0
  31. package/harmony/rn_webview/src/main/ets/CutomReference.ts +50 -0
  32. package/harmony/rn_webview/src/main/ets/Logger.ts +64 -0
  33. package/harmony/rn_webview/src/main/ets/Magic.ets +205 -0
  34. package/harmony/rn_webview/src/main/ets/RNCWebView.ets +607 -0
  35. package/harmony/rn_webview/src/main/ets/RNCWebViewPackage.ets +66 -0
  36. package/harmony/rn_webview/src/main/ets/ShouldRequestUrl.ts +68 -0
  37. package/harmony/rn_webview/src/main/ets/WebViewBaseOperate.ets +463 -0
  38. package/harmony/rn_webview/src/main/ets/WebViewTurboModule.ets +78 -0
  39. package/harmony/rn_webview/src/main/ets/generated/components/RNCWebView.ts +509 -0
  40. package/harmony/rn_webview/src/main/ets/generated/components/ts.ts +5 -0
  41. package/harmony/rn_webview/src/main/ets/generated/index.ets +5 -0
  42. package/harmony/rn_webview/src/main/ets/generated/ts.ts +6 -0
  43. package/harmony/rn_webview/src/main/ets/generated/turboModules/RNCWebView.ts +18 -0
  44. package/harmony/rn_webview/src/main/ets/generated/turboModules/RNCWebViewModule.ts +16 -0
  45. package/harmony/rn_webview/src/main/ets/generated/turboModules/ts.ts +6 -0
  46. package/harmony/rn_webview/src/main/module.json5 +11 -0
  47. package/harmony/rn_webview/src/main/resources/base/element/string.json +40 -0
  48. package/harmony/rn_webview/src/main/resources/en_US/element/string.json +40 -0
  49. package/harmony/rn_webview/src/main/resources/zh_CN/element/string.json +40 -0
  50. package/harmony/rn_webview/src/test/List.test.ets +5 -0
  51. package/harmony/rn_webview/src/test/LocalUnit.test.ets +33 -0
  52. package/harmony/rn_webview/ts.ets +29 -0
  53. package/harmony/rn_webview.har +0 -0
  54. package/package.json +107 -0
  55. package/src/NativeRNCWebView.ts +16 -0
  56. package/src/NativeRNCWebViewModule.ts +17 -0
  57. package/src/RNCWebViewNativeComponent.ts +286 -0
  58. package/src/WebView.harmony.tsx +330 -0
  59. package/src/WebView.tsx +4 -0
  60. package/src/codegenUtils.ts +9 -0
  61. package/src/index.ts +4 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2015-present, Facebook, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # @react-native-oh-tpl/react-native-webview
2
+
3
+ This project is based on [react-native-webview@13.10.2](https://github.com/react-native-webview/react-native-webview/tree/v13.10.2)
4
+
5
+ ## Documentation
6
+
7
+ - [中文](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/react-native-webview.md)
8
+
9
+ - [English](https://gitee.com/react-native-oh-library/usage-docs/blob/master/en/react-native-webview.md)
10
+
11
+ ## License
12
+
13
+ This library is licensed under [The MIT License (MIT)](https://github.com/react-native-oh-library/react-native-webview/blob/sig/LICENSE)
@@ -0,0 +1,41 @@
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
+ /**
26
+ * Use these variables when you tailor your ArkTS code. They must be of the const type.
27
+ */
28
+ export const HAR_VERSION = '13.10.4-rc.4';
29
+ export const BUILD_MODE_NAME = 'debug';
30
+ export const DEBUG = true;
31
+ export const TARGET_NAME = 'default';
32
+
33
+ /**
34
+ * BuildProfile Class is used only for compatibility purposes.
35
+ */
36
+ export default class BuildProfile {
37
+ static readonly HAR_VERSION = HAR_VERSION;
38
+ static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
39
+ static readonly DEBUG = DEBUG;
40
+ static readonly TARGET_NAME = TARGET_NAME;
41
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2015-present, Facebook, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,33 @@
1
+ OPEN SOURCE SOFTWARE NOTICE
2
+
3
+ Please note we provide an open source software notice for the third party open source software along with this software and/or this software component (in the following just “this SOFTWARE”). The open source software licenses are granted by the respective right holders.
4
+
5
+ Warranty Disclaimer
6
+ THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
7
+
8
+ Copyright Notice and License Texts
9
+
10
+ ----------------------------------------------------------------------
11
+ Software: react-native-webview v13.6.2
12
+
13
+ MIT License
14
+
15
+ Copyright (c) 2015-present, Facebook, Inc.
16
+
17
+ Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ of this software and associated documentation files (the "Software"), to deal
19
+ in the Software without restriction, including without limitation the rights
20
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ copies of the Software, and to permit persons to whom the Software is
22
+ furnished to do so, subject to the following conditions:
23
+
24
+ The above copyright notice and this permission notice shall be included in all
25
+ copies or substantial portions of the Software.
26
+
27
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
+ SOFTWARE.
@@ -0,0 +1,45 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <configuration>
3
+ <oatconfig>
4
+ <licensefile>LICENSE</licensefile>
5
+ <filefilterlist>
6
+ <filefilter name="copyrightPolicyFilter" desc="Filters for compatibility,license header policies">
7
+ <filteritem type="filename" name="hvigorfile.ts" desc="hvigor构建脚本,DevEco Studio自动生成,不需要添加版权头"/>
8
+ <filteritem type="filename" name="*.json5" desc="hvigor工程配置文件,DevEco Studio自动生成,不需要添加版权头"/>
9
+ <filteritem type="filename" name="*.proto" desc="资源文件,不需要添加版权头"/>
10
+ <filteritem type="filename" name="*.json" desc="资源文件,不需要添加版权头"/>
11
+ <filteritem type="filepath" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
12
+ <filteritem type="filepath" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
13
+ <filteritem type="filepath" name="hvigor/hvigor-wrapper.js" desc="工程模板,不修改版权头,以防有修改版权风险"/>
14
+ <filteritem type="filename" name="LICENSE" desc="工程文件,不修改版权头"/>
15
+ <filteritem type="filepath" name="src/test/List.test.ets" desc="工程模板,不修改版权头"/>
16
+ <filteritem type="filepath" name="src/test/LocalUnit.test.ets" desc="工程模板,不修改版权头"/>
17
+ </filefilter>
18
+ <filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies">
19
+ <filteritem type="filename" name="hvigorfile.ts" desc="hvigor构建脚本,DevEco Studio自动生成,不需要添加许可证头"/>
20
+ <filteritem type="filename" name="*.json5" desc="hvigor工程配置文件,DevEco Studio自动生成,不需要添加许可证头"/>
21
+ <filteritem type="filename" name="LICENSE" desc="原三方库证书文件无需更改,因此添加过滤"/>
22
+ <filteritem type="filename" name="NOTICE" desc="NOTICE文件,因此添加过滤"/>
23
+ <filteritem type="filename" name="*.proto" desc="资源文件,不需要添加许可证头"/>
24
+ <filteritem type="filename" name="*.json" desc="资源文件,不需要添加许可证头"/>
25
+ <filteritem type="filepath" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
26
+ <filteritem type="filepath" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
27
+ <filteritem type="filepath" name="hvigor/hvigor-wrapper.js" desc="工程模板,不修改版权头,以防有修改版权风险"/>
28
+ <filteritem type="filepath" name="src/test/List.test.ets" desc="工程模板,不需要添加许可证头"/>
29
+ <filteritem type="filepath" name="src/test/LocalUnit.test.ets" desc="工程模板,不需要添加许可证头"/>
30
+ </filefilter>
31
+ <filefilter name="binaryFileTypePolicyFilter" desc="Filters for resources files policies">
32
+ <filteritem type="filename" name="icon.png" desc="应用图标"/>
33
+ <filteritem type="filename" name="app_icon.png" desc="应用图标"/>
34
+ <filteritem type="filename" name="warn.png" desc="页面展示图标"/>
35
+ </filefilter>
36
+ </filefilterlist>
37
+ <policylist>
38
+ <policy name="projectPolicy" desc="">
39
+ <policyitem type="license" name="MIT" path="src/.*" desc="license under the MIT"/>
40
+ <policyitem type="license" name="MIT" path="Index.ets" desc="license under the MIT"/>
41
+ <policyitem type="license" name="MIT" path="ts.ts" desc="license under the MIT"/>
42
+ </policy>
43
+ </policylist>
44
+ </oatconfig>
45
+ </configuration>
@@ -0,0 +1,11 @@
1
+ [
2
+ {
3
+ "Name": "react-native-webview",
4
+ "License": "MIT License",
5
+ "License File": "https://github.com/react-native-webview/react-native-webview/blob/master/LICENSE",
6
+ "Version Number": "13.6.2",
7
+ "Owner" : "Jamon Holmgren <jamon@infinite.red>"
8
+ "Upstream URL": "https://github.com/react-native-webview/react-native-webview",
9
+ "Description": "React Native WebView component for iOS, Android, macOS, and Windows"
10
+ }
11
+ ]
@@ -0,0 +1,28 @@
1
+ {
2
+ "apiType": "stageMode",
3
+ "buildOption": {
4
+ },
5
+ "buildOptionSet": [
6
+ {
7
+ "name": "release",
8
+ "arkOptions": {
9
+ "obfuscation": {
10
+ "ruleOptions": {
11
+ "enable": true,
12
+ "files": [
13
+ "./obfuscation-rules.txt"
14
+ ]
15
+ },
16
+ "consumerFiles": [
17
+ "./consumer-rules.txt"
18
+ ]
19
+ }
20
+ }
21
+ },
22
+ ],
23
+ "targets": [
24
+ {
25
+ "name": "default"
26
+ }
27
+ ]
28
+ }
File without changes
@@ -0,0 +1 @@
1
+ export { harTasks } from '@ohos/hvigor-ohos-plugin';
@@ -0,0 +1,34 @@
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 {RNCWebView as WebView} from './src/main/ets/RNCWebView'
26
+ import {RNCWebViewPackage as WebViewPackage} from './src/main/ets/RNCWebViewPackage'
27
+
28
+ export {WebViewPackage};
29
+ export { WebView }
30
+
31
+ export * from './src/main/ets/RNCWebView'
32
+
33
+ export * from './ts'
34
+ export default WebViewPackage
@@ -0,0 +1,18 @@
1
+ # Define project specific obfuscation rules here.
2
+ # You can include the obfuscation configuration files in the current module's build-profile.json5.
3
+ #
4
+ # For more details, see
5
+ # https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md
6
+
7
+ # Obfuscation options:
8
+ # -disable-obfuscation: disable all obfuscations
9
+ # -enable-property-obfuscation: obfuscate the property names
10
+ # -enable-toplevel-obfuscation: obfuscate the names in the global scope
11
+ # -compact: remove unnecessary blank spaces and all line feeds
12
+ # -remove-log: remove all console.* statements
13
+ # -print-namecache: print the name cache that contains the mapping from the old names to new names
14
+ # -apply-namecache: reuse the given cache file
15
+
16
+ # Keep options:
17
+ # -keep-property-name: specifies property names that you want to keep
18
+ # -keep-global-name: specifies names that you want to keep in the global scope
@@ -0,0 +1,13 @@
1
+ {
2
+ "license": "Apache-2.0",
3
+ "devDependencies": {
4
+ },
5
+ "author": "",
6
+ "name": "@react-native-ohos/react-native-webview",
7
+ "description": "main cpai architecture",
8
+ "main": "index.ets",
9
+ "version": "13.10.5-rc.1",
10
+ "dependencies": {
11
+ "@rnoh/react-native-openharmony": "0.72.59"
12
+ }
13
+ }
@@ -0,0 +1,9 @@
1
+ cmake_minimum_required(VERSION 3.13)
2
+ set(CMAKE_VERBOSE_MAKEFILE on)
3
+
4
+ set(rnoh_webview_generated_dir "${CMAKE_CURRENT_SOURCE_DIR}/generated")
5
+ file(GLOB_RECURSE rnoh_webview_generated_SRC "${rnoh_webview_generated_dir}/**/*.cpp")
6
+ file(GLOB rnoh_webview_SRC CONFIGURE_DEPENDS *.cpp)
7
+ add_library(rnoh_webview SHARED ${rnoh_webview_SRC} ${rnoh_webview_generated_SRC})
8
+ target_include_directories(rnoh_webview PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${rnoh_webview_generated_dir})
9
+ target_link_libraries(rnoh_webview PUBLIC rnoh)
@@ -0,0 +1,37 @@
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
+ #ifndef WEBVIEWPACKAGE_H
26
+ #define WEBVIEWPACKAGE_H
27
+
28
+ #include "generated/RNOH/generated/BaseReactNativeWebviewPackage.h"
29
+ #pragma once
30
+
31
+ namespace rnoh {
32
+ class WebViewPackage : public BaseReactNativeWebviewPackage {
33
+ using Super = BaseReactNativeWebviewPackage;
34
+ using Super::Super;
35
+ };
36
+ } // namespace rnoh
37
+ #endif //WEBVIEWPACKAGE_H
@@ -0,0 +1,95 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+ #ifndef BASEREACTNATIVEWEBVIEWPACKAGE_H
5
+ #define BASEREACTNATIVEWEBVIEWPACKAGE_H
6
+ #pragma once
7
+
8
+ #include <react/renderer/components/react_native_webview/ComponentDescriptors.h>
9
+ #include "RNOH/Package.h"
10
+ #include "RNOH/ArkTSTurboModule.h"
11
+ #include "RNOH/generated/turbo_modules/RNCWebView.h"
12
+ #include "RNOH/generated/turbo_modules/RNCWebViewModule.h"
13
+ #include "RNOH/generated/components/RNCWebViewJSIBinder.h"
14
+
15
+ namespace rnoh {
16
+
17
+ class BaseReactNativeWebviewPackageTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
18
+ public:
19
+ SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override
20
+ {
21
+ if (name == "RNCWebView") {
22
+ return std::make_shared<RNCWebView>(ctx, name);
23
+ }
24
+ if (name == "RNCWebViewModule") {
25
+ return std::make_shared<RNCWebViewModule>(ctx, name);
26
+ }
27
+ return nullptr;
28
+ };
29
+ };
30
+
31
+ class BaseReactNativeWebviewPackageEventEmitRequestHandler : public EventEmitRequestHandler {
32
+ public:
33
+ void handleEvent(Context const &ctx) override
34
+ {
35
+ auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::EventEmitter>(ctx.tag);
36
+ if (eventEmitter == nullptr) {
37
+ return;
38
+ }
39
+
40
+ std::vector<std::string> supportedEventNames = {
41
+ "contentSizeChange",
42
+ "renderProcessGone",
43
+ "contentProcessDidTerminate",
44
+ "customMenuSelection",
45
+ "fileDownload",
46
+ "loadingError",
47
+ "loadingFinish",
48
+ "loadingProgress",
49
+ "loadingStart",
50
+ "httpError",
51
+ "message",
52
+ "openWindow",
53
+ "scroll",
54
+ "shouldStartLoadWithRequest",
55
+ };
56
+ if (std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName)
57
+ != supportedEventNames.end()) {
58
+ eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
59
+ }
60
+ }
61
+ };
62
+
63
+ class BaseReactNativeWebviewPackage : public Package {
64
+ public:
65
+ BaseReactNativeWebviewPackage(Package::Context ctx) : Package(ctx) {};
66
+
67
+ std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override
68
+ {
69
+ return std::make_unique<BaseReactNativeWebviewPackageTurboModuleFactoryDelegate>();
70
+ }
71
+
72
+ std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override
73
+ {
74
+ return {
75
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNCWebViewComponentDescriptor>(),
76
+ };
77
+ }
78
+
79
+ ComponentJSIBinderByString createComponentJSIBinderByName() override
80
+ {
81
+ return {
82
+ {"RNCWebView", std::make_shared<RNCWebViewJSIBinder>()},
83
+ };
84
+ };
85
+
86
+ EventEmitRequestHandlers createEventEmitRequestHandlers() override
87
+ {
88
+ return {
89
+ std::make_shared<BaseReactNativeWebviewPackageEventEmitRequestHandler>(),
90
+ };
91
+ }
92
+ };
93
+
94
+ } // namespace rnoh
95
+ #endif
@@ -0,0 +1,126 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ #pragma once
6
+ #include "RNOHCorePackage/ComponentBinders/ViewComponentJSIBinder.h"
7
+
8
+ namespace rnoh {
9
+ class RNCWebViewJSIBinder : public ViewComponentJSIBinder {
10
+ protected:
11
+ facebook::jsi::Object createNativeProps(facebook::jsi::Runtime &rt) override
12
+ {
13
+ auto object = ViewComponentJSIBinder::createNativeProps(rt);
14
+ setFirstProps(rt, object);
15
+ object.setProperty(rt, "sharedCookiesEnabled", true);
16
+ object.setProperty(rt, "textInteractionEnabled", true);
17
+ object.setProperty(rt, "useSharedProcessPool", true);
18
+ object.setProperty(rt, "menuItems", true);
19
+ object.setProperty(rt, "suppressMenuItems", true);
20
+ object.setProperty(rt, "hasOnFileDownload", true);
21
+ object.setProperty(rt, "fraudulentWebsiteWarningEnabled", true);
22
+ object.setProperty(rt, "allowFileAccessFromFileURLs", true);
23
+ object.setProperty(rt, "allowUniversalAccessFromFileURLs", true);
24
+ object.setProperty(rt, "applicationNameForUserAgent", true);
25
+ object.setProperty(rt, "basicAuthCredential", true);
26
+ object.setProperty(rt, "cacheEnabled", true);
27
+ object.setProperty(rt, "incognito", true);
28
+ object.setProperty(rt, "injectedJavaScript", true);
29
+ object.setProperty(rt, "injectedJavaScriptBeforeContentLoaded", true);
30
+ object.setProperty(rt, "injectedJavaScriptForMainFrameOnly", true);
31
+ object.setProperty(rt, "injectedJavaScriptBeforeContentLoadedForMainFrameOnly", true);
32
+ object.setProperty(rt, "javaScriptCanOpenWindowsAutomatically", true);
33
+ object.setProperty(rt, "javaScriptEnabled", true);
34
+ object.setProperty(rt, "webviewDebuggingEnabled", true);
35
+ object.setProperty(rt, "mediaPlaybackRequiresUserAction", true);
36
+ object.setProperty(rt, "messagingEnabled", true);
37
+ object.setProperty(rt, "shouldStartLoadWithRequestEnabled", true);
38
+ object.setProperty(rt, "hasOnOpenWindowEvent", true);
39
+ object.setProperty(rt, "showsHorizontalScrollIndicator", true);
40
+ object.setProperty(rt, "showsVerticalScrollIndicator", true);
41
+ object.setProperty(rt, "newSource", true);
42
+ object.setProperty(rt, "userAgent", true);
43
+ object.setProperty(rt, "schemeList", true);
44
+ return object;
45
+ }
46
+ private:
47
+ void setFirstProps(facebook::jsi::Runtime &rt, facebook::jsi::Object& object)
48
+ {
49
+ // 单个函数行数过多静态检查失败,拆分出来
50
+ object.setProperty(rt, "allowFileAccess", true);
51
+ object.setProperty(rt, "allowsProtectedMedia", true);
52
+ object.setProperty(rt, "allowsFullscreenVideo", true);
53
+ object.setProperty(rt, "androidLayerType", true);
54
+ object.setProperty(rt, "cacheMode", true);
55
+ object.setProperty(rt, "domStorageEnabled", true);
56
+ object.setProperty(rt, "downloadingMessage", true);
57
+ object.setProperty(rt, "forceDarkOn", true);
58
+ object.setProperty(rt, "geolocationEnabled", true);
59
+ object.setProperty(rt, "lackPermissionToDownloadMessage", true);
60
+ object.setProperty(rt, "messagingModuleName", true);
61
+ object.setProperty(rt, "minimumFontSize", true);
62
+ object.setProperty(rt, "mixedContentMode", true);
63
+ object.setProperty(rt, "nestedScrollEnabled", true);
64
+ object.setProperty(rt, "overScrollMode", true);
65
+ object.setProperty(rt, "saveFormDataDisabled", true);
66
+ object.setProperty(rt, "scalesPageToFit", true);
67
+ object.setProperty(rt, "setBuiltInZoomControls", true);
68
+ object.setProperty(rt, "setDisplayZoomControls", true);
69
+ object.setProperty(rt, "setSupportMultipleWindows", true);
70
+ object.setProperty(rt, "textZoom", true);
71
+ object.setProperty(rt, "thirdPartyCookiesEnabled", true);
72
+ object.setProperty(rt, "hasOnScroll", true);
73
+ object.setProperty(rt, "injectedJavaScriptObject", true);
74
+ object.setProperty(rt, "allowingReadAccessToURL", true);
75
+ object.setProperty(rt, "allowsBackForwardNavigationGestures", true);
76
+ object.setProperty(rt, "allowsInlineMediaPlayback", true);
77
+ object.setProperty(rt, "allowsAirPlayForMediaPlayback", true);
78
+ object.setProperty(rt, "allowsLinkPreview", true);
79
+ object.setProperty(rt, "automaticallyAdjustContentInsets", true);
80
+ object.setProperty(rt, "ignoreSilentHardwareSwitch", true);
81
+ object.setProperty(rt, "autoManageStatusBarEnabled", true);
82
+ object.setProperty(rt, "bounces", true);
83
+ object.setProperty(rt, "contentInset", true);
84
+ object.setProperty(rt, "contentInsetAdjustmentBehavior", true);
85
+ object.setProperty(rt, "contentMode", true);
86
+ object.setProperty(rt, "dataDetectorTypes", true);
87
+ object.setProperty(rt, "decelerationRate", true);
88
+ object.setProperty(rt, "directionalLockEnabled", true);
89
+ object.setProperty(rt, "enableApplePay", true);
90
+ object.setProperty(rt, "hideKeyboardAccessoryView", true);
91
+ object.setProperty(rt, "keyboardDisplayRequiresUserAction", true);
92
+ object.setProperty(rt, "limitsNavigationsToAppBoundDomains", true);
93
+ object.setProperty(rt, "mediaCapturePermissionGrantType", true);
94
+ object.setProperty(rt, "pagingEnabled", true);
95
+ object.setProperty(rt, "pullToRefreshEnabled", true);
96
+ object.setProperty(rt, "scrollEnabled", true);
97
+ }
98
+ facebook::jsi::Object createBubblingEventTypes(facebook::jsi::Runtime &rt) override
99
+ {
100
+ facebook::jsi::Object events(rt);
101
+ return events;
102
+ }
103
+
104
+ facebook::jsi::Object createDirectEventTypes(facebook::jsi::Runtime &rt) override
105
+ {
106
+ facebook::jsi::Object events(rt);
107
+ events.setProperty(rt, "topContentSizeChange", createDirectEvent(rt, "onContentSizeChange"));
108
+ events.setProperty(rt, "topRenderProcessGone", createDirectEvent(rt, "onRenderProcessGone"));
109
+ events.setProperty(rt, "topContentProcessDidTerminate",
110
+ createDirectEvent(rt, "onContentProcessDidTerminate"));
111
+ events.setProperty(rt, "topCustomMenuSelection", createDirectEvent(rt, "onCustomMenuSelection"));
112
+ events.setProperty(rt, "topFileDownload", createDirectEvent(rt, "onFileDownload"));
113
+ events.setProperty(rt, "topLoadingError", createDirectEvent(rt, "onLoadingError"));
114
+ events.setProperty(rt, "topLoadingFinish", createDirectEvent(rt, "onLoadingFinish"));
115
+ events.setProperty(rt, "topLoadingProgress", createDirectEvent(rt, "onLoadingProgress"));
116
+ events.setProperty(rt, "topLoadingStart", createDirectEvent(rt, "onLoadingStart"));
117
+ events.setProperty(rt, "topHttpError", createDirectEvent(rt, "onHttpError"));
118
+ events.setProperty(rt, "topMessage", createDirectEvent(rt, "onMessage"));
119
+ events.setProperty(rt, "topOpenWindow", createDirectEvent(rt, "onOpenWindow"));
120
+ events.setProperty(rt, "topScroll", createDirectEvent(rt, "onScroll"));
121
+ events.setProperty(rt, "topShouldStartLoadWithRequest",
122
+ createDirectEvent(rt, "onShouldStartLoadWithRequest"));
123
+ return events;
124
+ }
125
+ };
126
+ } // namespace rnoh
@@ -0,0 +1,20 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ #include "RNCWebView.h"
6
+
7
+ namespace rnoh {
8
+ using namespace facebook;
9
+
10
+ RNCWebView::RNCWebView(const ArkTSTurboModule::Context ctx, const std::string name)
11
+ : ArkTSTurboModule(ctx, name)
12
+ {
13
+ methodMap_ = {
14
+ ARK_METHOD_METADATA(getConstants, 0),
15
+ ARK_ASYNC_METHOD_METADATA(isFileUploadSupported, 0),
16
+ ARK_METHOD_METADATA(shouldStartLoadWithLockIdentifier, 2),
17
+ };
18
+ }
19
+
20
+ } // namespace rnoh
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ #pragma once
6
+
7
+ #include "RNOH/ArkTSTurboModule.h"
8
+
9
+ namespace rnoh {
10
+
11
+ class JSI_EXPORT RNCWebView : public ArkTSTurboModule {
12
+ public:
13
+ RNCWebView(const ArkTSTurboModule::Context ctx, const std::string name);
14
+ };
15
+
16
+ } // namespace rnoh
@@ -0,0 +1,19 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ #include "RNCWebViewModule.h"
6
+
7
+ namespace rnoh {
8
+ using namespace facebook;
9
+
10
+ RNCWebViewModule::RNCWebViewModule(const ArkTSTurboModule::Context ctx, const std::string name)
11
+ : ArkTSTurboModule(ctx, name)
12
+ {
13
+ methodMap_ = {
14
+ ARK_ASYNC_METHOD_METADATA(isFileUploadSupported, 0),
15
+ ARK_METHOD_METADATA(shouldStartLoadWithLockIdentifier, 2),
16
+ };
17
+ }
18
+
19
+ } // namespace rnoh
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ #pragma once
6
+
7
+ #include "RNOH/ArkTSTurboModule.h"
8
+
9
+ namespace rnoh {
10
+
11
+ class JSI_EXPORT RNCWebViewModule : public ArkTSTurboModule {
12
+ public:
13
+ RNCWebViewModule(const ArkTSTurboModule::Context ctx, const std::string name);
14
+ };
15
+
16
+ } // namespace rnoh