From 35b0c22ab46747d54fcabf3a78ca8a8d5afdbebf Mon Sep 17 00:00:00 2001 From: liuzhipeng <1546610747@qq.com> Date: Sat, 6 Dec 2025 18:34:27 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20[Issues:=20#IDB5OV]=20=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=BA=93=E9=80=82=E9=85=8Dcli=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E9=9C=80=E6=B1=8211=E4=B8=AA=E4=B8=89=E6=96=B9=E5=BA=93?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- en/react-native-audio.md | 13 ++-- en/react-native-get-random-values.md | 82 +++++++++++++++++++---- en/react-native-image-colors.md | 31 +++++---- en/react-native-image-crop-picker.md | 24 ++++--- en/react-native-image-rotate.md | 86 ++++++++++++++++++++----- en/react-native-inappbrowser.md | 33 ++++++---- en/react-native-network-info.md | 11 ++-- en/react-native-print.md | 21 +++--- en/react-native-securerandom.md | 81 +++++++++++++++++++---- en/react-native-shake.md | 21 ++---- en/react-native-ssl-pinning.md | 78 +++++++++++++++++++--- zh-cn/react-native-audio.md | 10 +-- zh-cn/react-native-get-random-values.md | 82 +++++++++++++++++++---- zh-cn/react-native-image-colors.md | 26 ++++---- zh-cn/react-native-image-crop-picker.md | 23 ++++--- zh-cn/react-native-image-rotate.md | 84 ++++++++++++++++++++---- zh-cn/react-native-inappbrowser.md | 30 +++++---- zh-cn/react-native-network-info.md | 11 ++-- zh-cn/react-native-print.md | 19 +++--- zh-cn/react-native-securerandom.md | 78 +++++++++++++++++++--- zh-cn/react-native-shake.md | 20 ++---- zh-cn/react-native-ssl-pinning.md | 80 ++++++++++++++++++++--- 22 files changed, 713 insertions(+), 231 deletions(-) diff --git a/en/react-native-audio.md b/en/react-native-audio.md index 3b0a630f..511e8b82 100644 --- a/en/react-native-audio.md +++ b/en/react-native-audio.md @@ -12,11 +12,11 @@ Please refer to the Releases page of the third-party library for the correspondi | Third-party Library Version | Release Information | Supported RN Version | |-----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------| ---------- | -| 4.2.3@deprecated | [@react-native-oh-tpl/react-native-audio Releases(deprecated)](https://github.com/react-native-oh-library/react-native-audio/releases) | 0.72 | +| <= 4.3.1-0.1.0@deprecated | [@react-native-oh-tpl/react-native-audio Releases(deprecated)](https://github.com/react-native-oh-library/react-native-audio/releases) | 0.72 | | 4.2.4 | [@react-native-ohos/react-native-audio Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-audio/releases) | 0.72 | | 4.3.0 | [@react-native-ohos/react-native-audio Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-audio/releases) | 0.77 | -For older versions not published on npm, please refer to the [Installation Guide](/zh-cn/tgz-usage.md) to install the tgz package. +For older versions not published on npm, please refer to the [Installation Guide](/en/tgz-usage-en.md) to install the tgz package. Go to the project directory and execute the following instruction: @@ -249,7 +249,7 @@ Method 2: Directly link to the source code. ### 2.3 Configuring CMakeLists and Introducing AudioPackage Package -> **[!TIP] Version 4.2.4 and above requires.** +> If you are using version <= 4.3.1-0.1.0, please skip this chapter. Open entry/src/main/cpp/CMakeLists.txt and add the following code: @@ -315,10 +315,11 @@ Then build and run the code. To use this repository, you need to use the correct React-Native and RNOH versions. In addition, you need to use DevEco Studio and the ROM on your phone. -The following combinations have been verified: +Verified in the following versions. -1. RNOH:0.72.96; SDK:HarmonyOS 5.1.0.150 (API Version 12); IDE:DevEco Studio 5.1.1.830; ROM:5.1.0.150; -2. RNOH:0.77.18; SDK:HarmonyOS 5.1.0.150 (API Version 12); IDE:DevEco Studio 5.1.1.830; ROM:5.1.0.150; +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; ## 4. API diff --git a/en/react-native-get-random-values.md b/en/react-native-get-random-values.md index 20a03cc1..54d33486 100644 --- a/en/react-native-get-random-values.md +++ b/en/react-native-get-random-values.md @@ -21,7 +21,7 @@ Please refer to the Releases page of the third-party library for the correspondi | Third-party Library Version | Release Information | Supported RN Version | | ---------- | ------------------------------------------------------------ | ---------- | -| 1.11.0@deprecated | [@react-native-oh-tpl/react-native-get-random-values Releases(deprecated)](https://github.com/react-native-oh-library/react-native-get-random-values/releases) | 0.72 | +| <= 1.11.0-0.0.1@deprecated | [@react-native-oh-tpl/react-native-get-random-values Releases(deprecated)](https://github.com/react-native-oh-library/react-native-get-random-values/releases) | 0.72 | | 1.11.1 | [@react-native-ohos/react-native-get-random-values Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-get-random-values/releases) | 0.72 | | 1.12.0 | [@react-native-ohos/react-native-get-random-values Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-get-random-values/releases) | 0.77 | @@ -138,7 +138,68 @@ Method 2: Directly link to the source code. > [!TIP] For details, see [Directly Linking Source Code](/en/link-source-code.md). -### 3. Introducing RNGetRandomValuesPackage to ArkTS +### 3.Configuring CMakeLists and Introducing GetRandomValuesPackage + +> If you are using version <= 1.11.0-0.0.1, please skip this chapter. + +Open `entry/src/main/cpp/CMakeLists.txt` and add the following code: + +```diff +project(rnapp) +cmake_minimum_required(VERSION 3.4.1) +set(CMAKE_SKIP_BUILD_RPATH TRUE) +set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}") +set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules") ++ set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules") +set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp") +set(LOG_VERBOSITY_LEVEL 1) +set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments") +set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie") +set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use +add_compile_definitions(WITH_HITRACE_SYSTRACE) + +add_subdirectory("${RNOH_CPP_DIR}" ./rn) + +# RNOH_BEGIN: manual_package_linking_1 +add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) ++ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-get-random-values/src/main/cpp" ./get_random_values) + +# RNOH_END: manual_package_linking_1 + +file(GLOB GENERATED_CPP_FILES "./generated/*.cpp") + +add_library(rnoh_app SHARED + ${GENERATED_CPP_FILES} + "./PackageProvider.cpp" + "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp" +) +target_link_libraries(rnoh_app PUBLIC rnoh) + +# RNOH_BEGIN: manual_package_linking_2 +target_link_libraries(rnoh_app PUBLIC rnoh_sample_package) ++ target_link_libraries(rnoh_app PUBLIC rnoh_get_random_values) +# RNOH_END: manual_package_linking_2 +``` +Open `entry/src/main/cpp/PackageProvider.cpp`,and add the following code: + +```diff +#include "RNOH/PackageProvider.h" +#include "generated/RNOHGeneratedPackage.h" +#include "SamplePackage.h" ++ #include "GetRandomValuesPackage.h" + +using namespace rnoh; + +std::vector> PackageProvider::getPackages(Package::Context ctx) { + return { + std::make_shared(ctx), + std::make_shared(ctx), ++ std::make_shared(ctx) + }; +} +``` + +### 4. Introducing RNGetRandomValuesPackage to ArkTS Open the `entry/src/main/ets/RNPackagesFactory.ts` file and add the following code: @@ -154,7 +215,7 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { } ``` -### 4. Running +### 5. Running Click the `sync` button in the upper right corner. @@ -171,18 +232,13 @@ Then build and run the code. ### Compatibility -Please refer to the Releases page of the third-party library for the corresponding version information: - -| Third-party Library Version | Release Information | Supported RN Version | -| ---------- | ------------------------------------------------------------ | ---------- | -| 1.11.0@deprecated | [@react-native-oh-tpl/react-native-get-random-values Releases(deprecated)](https://github.com/react-native-oh-library/react-native-get-random-values/releases) | 0.72 | -| 1.11.1 | [@react-native-ohos/react-native-get-random-values Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-get-random-values/releases) | 0.72 | -| 1.12.0 | [@react-native-ohos/react-native-get-random-values Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-get-random-values/releases) | 0.77 | +To use this repository, you need to use the correct React-Native and RNOH versions. In addition, you need to use DevEco Studio and the ROM on your phone. -This document is verified based on the following versions: +Verified in the following versions. -1. RNOH: 0.72.20-CAPI; SDK: HarmonyOS NEXT Developer Preview2; IDE: DevEco Studio 4.1.3.700; ROM: 3.0.0.19; -2. RNOH:0.77.18; SDK:HarmonyOS 6.0.0.47 (API Version 20); IDE:DevEco Studio 6.0.0.858; ROM:6.0.0.107; +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; ## Static Methods diff --git a/en/react-native-image-colors.md b/en/react-native-image-colors.md index 046b97c2..1018f213 100644 --- a/en/react-native-image-colors.md +++ b/en/react-native-image-colors.md @@ -19,11 +19,11 @@ Please refer to the Releases page of the third-party library for the correspondi | Third-party Library Version | Release Information | Supported RN Version | | ---------- | ------------------------------------------------------------ | ---------- | -| 2.4.0@deprecated | [@react-native-oh-tpl/react-native-image-colors Releases(deprecated)](https://github.com/react-native-oh-library/react-native-image-colors/releases) | 0.72 | +| <= 2.4.0-0.0.7@deprecated | [@react-native-oh-tpl/react-native-image-colors Releases(deprecated)](https://github.com/react-native-oh-library/react-native-image-colors/releases) | 0.72 | | 2.4.1 | [@react-native-ohos/react-native-image-colors Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-image-colors/releases) | 0.72 | | 2.5.1 | [@react-native-ohos/react-native-image-colors Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-image-colors/releases) | 0.77 | -For older versions not published on npm, please refer to the [Installation Guide](/zh-cn/tgz-usage.md) to install the tgz package. +For older versions not published on npm, please refer to the [Installation Guide](/en/tgz-usage-en.md) to install the tgz package. ## Installation and Usage @@ -261,11 +261,11 @@ Method 2: Directly link to the source code. ### 3. Configure CMakeLists and import ImageColorsPackage -> [!TIP] If using version 2.4.0, please skip this chapter +> If you are using version <= 2.4.0-0.0.7, please skip this chapter. -open `entry/src/main/cpp/CMakeLists.txt`,add: +Open `entry/src/main/cpp/CMakeLists.txt` and add the following code: -```cmake +```diff project(rnapp) cmake_minimum_required(VERSION 3.4.1) set(CMAKE_SKIP_BUILD_RPATH TRUE) @@ -284,6 +284,7 @@ add_subdirectory("${RNOH_CPP_DIR}" ./rn) # RNOH_BEGIN: manual_package_linking_1 add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) + add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-image-colors/src/main/cpp" ./image-colors) + # RNOH_END: manual_package_linking_1 file(GLOB GENERATED_CPP_FILES "./generated/*.cpp") @@ -300,10 +301,9 @@ target_link_libraries(rnoh_app PUBLIC rnoh_sample_package) + target_link_libraries(rnoh_app PUBLIC rnoh_image_colors) # RNOH_END: manual_package_linking_2 ``` +Open `entry/src/main/cpp/PackageProvider.cpp`,and add the following code: -open `entry/src/main/cpp/PackageProvider.cpp`,add: - -```c++ +```diff #include "RNOH/PackageProvider.h" #include "generated/RNOHGeneratedPackage.h" #include "SamplePackage.h" @@ -313,9 +313,9 @@ using namespace rnoh; std::vector> PackageProvider::getPackages(Package::Context ctx) { return { - std::make_shared(ctx), - std::make_shared(ctx), -+ std::make_shared(ctx) + std::make_shared(ctx), + std::make_shared(ctx), ++ std::make_shared(ctx) }; } ``` @@ -353,10 +353,13 @@ Then build and run the code. ### Compatibility -This document is verified based on the following versions: +To use this repository, you need to use the correct React-Native and RNOH versions. In addition, you need to use DevEco Studio and the ROM on your phone. + +Verified in the following versions. -1. RNOH:0.72.33; SDK:OpenHarmony 5.0.0.71(API Version 12 Release); IDE:DevEco Studio 5.0.3.900; ROM:NEXT.0.0.71; -2. RNOH: 0.77.17; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.868; ROM: 6.0.0.112; +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; ## API diff --git a/en/react-native-image-crop-picker.md b/en/react-native-image-crop-picker.md index aec26ebc..19232e3f 100644 --- a/en/react-native-image-crop-picker.md +++ b/en/react-native-image-crop-picker.md @@ -6,15 +6,17 @@ > [!TIP] [GitHub address](https://github.com/react-native-oh-library/react-native-image-crop-picker) -This third-party library has been migrated to Gitcode and is now available for direct download from npm, the new package name is: `@react-native-ohos/react-native-image-crop-picker`, After introducing the new version of the third-party library, The version correspondence details are as follows: +## 1.Installation and Usage + +Please refer to the Releases page of the third-party library for the corresponding version information: | Third-party Library Version | Release Information | Supported RN Version | |--------| ------------------------------------------------------------ | ---------- | -| 0.40.4@deprecated | [@react-native-oh-tpl/react-native-image-crop-picker Releases(deprecated)](https://github.com/react-native-oh-library/react-native-image-crop-picker/releases) | 0.72 | +| <= 0.40.3-0.0.14@deprecated | [@react-native-oh-tpl/react-native-image-crop-picker Releases(deprecated)](https://github.com/react-native-oh-library/react-native-image-crop-picker/releases) | 0.72 | | 0.40.5 | [@react-native-ohos/react-native-image-crop-picker Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-image-crop-picker/releases) | 0.72 | -| 0.50.2 | [@react-native-ohos/react-native-image-crop-picker Releases]() | 0.77 | +| 0.50.2 | [@react-native-ohos/react-native-image-crop-picker Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-image-crop-picker/releases) | 0.77 | -## 1. Installation and Usage +For older versions that are not published to npm, please refer to the [installation guide](/en/tgz-usage-en.md) to install the tgz package. Go to the project directory and execute the following instruction: @@ -789,7 +791,7 @@ export default ImageCropPickDemo; ## 2. Manual Link -Version >= @react-native-ohos/react-native-image-crop-picker@0.40.5 now supports Autolink without requiring manual configuration, currently only supports 72 frameworks. Autolink Framework Guide Documentation: https://gitcode.com/openharmony-sig/ohos_react_native/blob/master/docs/zh-cn/Autolinking.md +Version >= @react-native-ohos/react-native-image-crop-picker@0.40.5 now supports Autolink without requiring manual configuration(The content that still needs to be manually configured has been marked in the corresponding title), currently only supports 72 frameworks. Autolink Framework Guide Documentation: https://gitcode.com/openharmony-sig/ohos_react_native/blob/master/docs/zh-cn/Autolinking.md This step provides guidance for manually configuring native dependencies. @@ -846,7 +848,7 @@ Method 2: Directly link to the source code. ### 2.3 Configuring CMakeLists and Introducing ImageCropPickerPackage -> [!TIP] Required for version `0.77` and above +> If you are using version <= 0.40.3-0.0.14, please skip this chapter. Open `entry/src/main/cpp/CMakeLists.txt` and add the following code: @@ -912,7 +914,7 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { } ``` -### 2.5. Configuration Entry +### 2.5. Configuration Entry(This module always requires manual configuration) **(1)Create ImageEditAbility.ets under entry/src/main/ets/entryability** @@ -1031,11 +1033,13 @@ Then build and run the code. ### 3.1. Compatibility -Verified in the following version: +To use this repository, you need to use the correct React-Native and RNOH versions. In addition, you need to use DevEco Studio and the ROM on your phone. -RNOH: 0.72.20; SDK: HarmonyOS NEXT Developer Beta1; IDE: DevEco Studio 5.0.3.200;ROM: 3.0.0.18; +Verified in the following versions. -RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK;IDE: DevEco Studio 6.0.0.868;ROM:6.0.0.112; +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; ## 4. API diff --git a/en/react-native-image-rotate.md b/en/react-native-image-rotate.md index 1ac86797..64a93270 100644 --- a/en/react-native-image-rotate.md +++ b/en/react-native-image-rotate.md @@ -21,11 +21,11 @@ Please refer to the Releases page of the third-party library for the correspondi | Third-party Library Version | Release Information | Supported RN Version | |-------| ------------------------------------------------------------ | ---------- | -| 2.1.0@deprecated | [@react-native-oh-tpl/react-native-image-rotate Releases(deprecated)](https://github.com/react-native-oh-library/react-native-image-rotate/releases) | 0.72 | +| <= 2.1.0-0.0.1@deprecated | [@react-native-oh-tpl/react-native-image-rotate Releases(deprecated)](https://github.com/react-native-oh-library/react-native-image-rotate/releases) | 0.72 | | 2.1.1 | [@react-native-ohos/react-native-image-rotate Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-image-rotate/releases) | 0.72 | | 2.2.0 | [@react-native-ohos/react-native-image-rotate Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-image-rotate/releases) | 0.77 | -For older versions not published on npm, please refer to the [Installation Guide](/zh-cn/tgz-usage.md) to install the tgz package. +For older versions not published on npm, please refer to the [Installation Guide](/en/tgz-usage-en.md) to install the tgz package. Go to the project directory and execute the following instruction: @@ -145,6 +145,8 @@ const styles = StyleSheet.create({ ## Use Codegen +Version >= @react-native-ohos/react-native-inappbrowser@2.1.1, The codegen-lib has been adapted to generate bridge code. + If this repository has been adapted to Codegen, generate the bridge code of the third-party library by using the Codegen. For details, see[ Codegen Usage Guide](/en/codegen.md). ## Link @@ -200,7 +202,68 @@ Method 2: Directly link to the source code. > [!TIP] For details, see[Directly Linking Source Code](/en/link-source-code.md) -### 3.Introducing RNImageRotatePackage Package to ArkTS +### 3.Configuring CMakeLists and Introducing ImageRotatePackage + +> If you are using version <= 2.1.0-0.0.1, please skip this chapter. + +Open `entry/src/main/cpp/CMakeLists.txt`, and add the following code: + +```diff +project(rnapp) +cmake_minimum_required(VERSION 3.4.1) +set(CMAKE_SKIP_BUILD_RPATH TRUE) +set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}") +set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules") ++ set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules") +set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp") +set(LOG_VERBOSITY_LEVEL 1) +set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments") +set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie") +set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use +add_compile_definitions(WITH_HITRACE_SYSTRACE) + +add_subdirectory("${RNOH_CPP_DIR}" ./rn) + +# RNOH_BEGIN: manual_package_linking_1 +add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) ++ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-image-rotate/src/main/cpp" ./imageRotate) + +# RNOH_END: manual_package_linking_1 + +file(GLOB GENERATED_CPP_FILES "./generated/*.cpp") + +add_library(rnoh_app SHARED + ${GENERATED_CPP_FILES} + "./PackageProvider.cpp" + "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp" +) +target_link_libraries(rnoh_app PUBLIC rnoh) + +# RNOH_BEGIN: manual_package_linking_2 +target_link_libraries(rnoh_app PUBLIC rnoh_sample_package) ++ target_link_libraries(rnoh_app PUBLIC rnoh_image_rotate) +# RNOH_END: manual_package_linking_2 +``` +Open `entry/src/main/cpp/PackageProvider.cpp`, and add the following code: + +```diff +#include "RNOH/PackageProvider.h" +#include "generated/RNOHGeneratedPackage.h" +#include "SamplePackage.h" ++ #include "ImageRotatePackage.h" + +using namespace rnoh; + +std::vector> PackageProvider::getPackages(Package::Context ctx) { + return { + std::make_shared(ctx), + std::make_shared(ctx), ++ std::make_shared(ctx) + }; +} +``` + +### 4.Introducing RNImageRotatePackage Package to ArkTS Open the entry/src/main/ets/RNPackagesFactory.ts file and add the following code: @@ -217,7 +280,7 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { } ``` -### 4.Running +### 5.Running Click the sync button in the upper right corner. @@ -236,18 +299,11 @@ Then build and run the code. To use this repository, you need to use the correct React-Native and RNOH versions. In addition, you need to use DevEco Studio and the ROM on your phone. -Please refer to the Releases page of the third-party library for the corresponding version information - -| Third-party Library Version | Release Information | Supported RN Version | -|-------| ------------------------------------------------------------ | ---------- | -| 2.1.0@deprecated | [@react-native-oh-tpl/react-native-image-rotate Releases(deprecated)](https://github.com/react-native-oh-library/react-native-image-rotate/releases) | 0.72 | -| 2.1.1 | [@react-native-ohos/react-native-image-rotate Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-image-rotate/releases) | 0.72 | -| 2.2.0 | [@react-native-ohos/react-native-image-rotate Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-image-rotate/releases) | 0.77 | - -The content of this document has been verified based on the following versions: +Verified in the following versions. -1. RNOH: 0.72.98; SDK: HarmonyOS-5.0.0(API12); IDE: DevEco Studio 5.0.3.906; ROM: NEXT.0.0.71; -2. RNOH:0.77.18; SDK:HarmonyOS 6.0.0.47 (API Version 20); IDE:DevEco Studio 6.0.0.858; ROM:6.0.0.107; +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; ## Static Method diff --git a/en/react-native-inappbrowser.md b/en/react-native-inappbrowser.md index b362f3e4..23da4bd2 100644 --- a/en/react-native-inappbrowser.md +++ b/en/react-native-inappbrowser.md @@ -14,20 +14,22 @@ > [!TIP] [GitHub address](https://github.com/react-native-oh-library/react-native-inappbrowser) +## Installation and Usage + Please refer to the Releases page of the third-party library for the corresponding version information | Third-party Library Version | Release Information | Supported RN Version | |-------| ------------------------------------------------------------ | ---------- | -| 3.7.0@deprecated | [@react-native-oh-tpl/react-native-inappbrowser-reborn Releases(deprecated)](https://github.com/react-native-oh-library/react-native-inappbrowser/releases) | 0.72 | +| <= 3.7.0-0.0.4@deprecated | [@react-native-oh-tpl/react-native-inappbrowser-reborn Releases(deprecated)](https://github.com/react-native-oh-library/react-native-inappbrowser/releases) | 0.72 | | 3.7.1 | [@react-native-ohos/react-native-inappbrowser-reborn Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-inappbrowser/releases) | 0.72 | | 3.8.0 | [@react-native-ohos/react-native-inappbrowser-reborn Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-inappbrowser/releases) | 0.77 | -For older versions not published on npm, please refer to the [Installation Guide](/zh-cn/tgz-usage.md) to install the tgz package. - -## Installation and Usage +For older versions not published on npm, please refer to the [Installation Guide](/en/tgz-usage-en.md) to install the tgz package. Go to the project directory and execute the following instruction: + + #### **npm** ``` @@ -292,7 +294,7 @@ If this repository has been adapted to `Codegen`, generate the bridge code of th ## Link -Version >= @react-native-ohos/react-native-inappbrowser@3.7.1,Autolink is supported, no manual configuration is required, and currently only supports 72 frames. Autolink Framework Guidance Document:https://gitcode.com/openharmony-sig/ohos_react_native/blob/master/docs/zh-cn/Autolinking.md +Version >= @react-native-ohos/react-native-inappbrowser@3.7.1,Autolink is supported, no manual configuration is required(The content that still needs to be manually configured has been marked in the corresponding title), and currently only supports 72 frames. Autolink Framework Guidance Document:https://gitcode.com/openharmony-sig/ohos_react_native/blob/master/docs/zh-cn/Autolinking.md This step provides guidance for manually configuring native dependencies. @@ -308,7 +310,7 @@ Adding the overrides Field to oh-package.json5 File in the Root Directory of the } ``` -### 1. Configuring Entry +### 1. Configuring Entry(This module always requires manual configuration) 1. Create **BrowserManagerAbility.ets** in **entry/src/main/ets/entryability**. @@ -452,7 +454,7 @@ Method 2: Directly link to the source code. ### 3.Configuring CMakeLists and Introducing InappbrowserRebornPackage -> [!TIP] If you are using version 3.7.0, please skip this chapter. +> If you are using version <= 3.7.0-0.0.4, please skip this chapter. open `entry/src/main/cpp/CMakeLists.txt` and add: @@ -474,7 +476,7 @@ add_subdirectory("${RNOH_CPP_DIR}" ./rn) # RNOH_BEGIN: manual_package_linking_1 add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) -+ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-inappbrowser-reborn/src/main/cpp" ./inappbrowser-reborn) ++ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-inappbrowser-reborn/src/main/cpp" ./inappbrowser) # RNOH_END: manual_package_linking_1 file(GLOB GENERATED_CPP_FILES "./generated/*.cpp") @@ -488,7 +490,7 @@ target_link_libraries(rnoh_app PUBLIC rnoh) # RNOH_BEGIN: manual_package_linking_2 target_link_libraries(rnoh_app PUBLIC rnoh_sample_package) -+ target_link_libraries(rnoh_app PUBLIC rnoh_inappbrowser_reborn) ++ target_link_libraries(rnoh_app PUBLIC rnoh_inappbrowser) # RNOH_END: manual_package_linking_2 ``` @@ -498,7 +500,7 @@ open `entry/src/main/cpp/PackageProvider.cpp` and add: #include "RNOH/PackageProvider.h" #include "generated/RNOHGeneratedPackage.h" #include "SamplePackage.h" -+ #include "InappbrowserRebornPackage.h" ++ #include "InAppBrowserPackage.h" using namespace rnoh; @@ -506,7 +508,7 @@ std::vector> PackageProvider::getPackages(Package::Cont return { std::make_shared(ctx), std::make_shared(ctx), -+ std::make_shared(ctx) ++ std::make_shared(ctx) }; } ``` @@ -544,10 +546,13 @@ Then build and run the code. ### Compatibility -This document is verified based on the following versions: +To use this repository, you need to use the correct React-Native and RNOH versions. In addition, you need to use DevEco Studio and the ROM on your phone. + +Verified in the following versions. -1. RNOH: 0.72.20; SDK: HarmonyOS NEXT Developer Beta1; IDE: DevEco Studio 5.0.3.200; ROM: 3.0.0.18; -2. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.868; ROM: 6.0.0.112; +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; ## API diff --git a/en/react-native-network-info.md b/en/react-native-network-info.md index 0b5184b0..b894ee0c 100644 --- a/en/react-native-network-info.md +++ b/en/react-native-network-info.md @@ -21,7 +21,7 @@ Find the matching version information in the release address of a third-party li | Third-party Library Version | Release Information | Supported RN Version | | ---------- | ------------------------------------------------------------ | ---------- | -| 5.2.1@deprecated | [@react-native-oh-tpl/react-native-network-info Releases(deprecated)](https://github.com/react-native-oh-library/react-native-network-info/releases) | 0.72 | +| <= 5.2.1-0.0.1@deprecated | [@react-native-oh-tpl/react-native-network-info Releases(deprecated)](https://github.com/react-native-oh-library/react-native-network-info/releases) | 0.72 | | 5.2.2 | [@react-native-ohos/react-native-network-info Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-network-info/releases) | 0.72 | | 5.3.0 | [@react-native-ohos/react-native-network-info Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-network-info/releases) | 0.77 | @@ -218,7 +218,7 @@ Method 2: Directly link to the source code. ### 3. Configure CMakeLists and Introduce RNOrientationPackage -> [!TIP] Version `5.3.0` and above require +> If you are using version <= 5.2.1-0.0.1, please skip this chapter. Open `entry/src/main/cpp/CMakeLists.txt`,Add: @@ -301,10 +301,11 @@ Then build and run the code. To use this repository, you need to use the correct React-Native and RNOH versions. In addition, you need to use DevEco Studio and the ROM on your phone. -The following combinations have been verified: +Verified in the following versions. -1. RNOH:0.72.96; SDK:HarmonyOS 5.1.0.150 (API Version 12); IDE:DevEco Studio 5.1.1.830; ROM:5.1.0.150; -2. RNOH:0.77.18; SDK:HarmonyOS 5.1.0.150 (API Version 12); IDE:DevEco Studio 5.1.1.830; ROM:5.1.0.150; +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; ### Permission Requirements diff --git a/en/react-native-print.md b/en/react-native-print.md index 819747a1..0627bdb3 100644 --- a/en/react-native-print.md +++ b/en/react-native-print.md @@ -14,17 +14,17 @@ > [!TIP] [GitHub address](https://github.com/react-native-oh-library/react-native-print) +## Installation and Usage + Please refer to the Releases page of the third-party library for the corresponding version information | Third-party Library Version | Release Information | Supported RN Version | | ---------- | ------------------------------------------------------------ | ---------- | -| 0.11.0@deprecated | [@react-native-oh-tpl/react-native-print Releases(deprecated)](https://github.com/react-native-oh-library/react-native-print/releases) | 0.72 | +| <= 0.11.0-0.0.3@deprecated | [@react-native-oh-tpl/react-native-print Releases(deprecated)](https://github.com/react-native-oh-library/react-native-print/releases) | 0.72 | | 0.11.1 | [@react-native-ohos/react-native-print Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-print/releases) | 0.72 | | 0.12.0 | [@react-native-ohos/react-native-print Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-print/releases) | 0.77 | -For older versions not published on npm, please refer to the [Installation Guide](/zh-cn/tgz-usage.md) to install the tgz package. - -## Installation and Usage +For older versions not published on npm, please refer to the [Installation Guide](/en/tgz-usage-en.md) to install the tgz package. Go to the project directory and execute the following instruction: @@ -118,7 +118,7 @@ export default function RNPrint(): JSX.Element { ## Use Codegen -[!TIP] V0.11.1 does not require executing Codegen. +Version >= @react-native-ohos/react-native-inappbrowser@0.11.1, The codegen-lib has been adapted to generate bridge code. If this repository has been adapted to `Codegen`, generate the bridge code of the third-party library by using the `Codegen`. For details, see [Codegen Usage Guide](/zh-cn/codegen.md). @@ -174,7 +174,7 @@ Method 2: Directly link to the source code. ### 3.Configuring CMakeLists and Introducing PrintPackage -> [!TIP] If you are using version 0.11.0, please skip this chapter. +> If you are using version <= 0.11.0-0.0.3, please skip this chapter. open `entry/src/main/cpp/CMakeLists.txt` and add: @@ -266,10 +266,13 @@ Then build and run the code. ### Compatibility -This document is verified based on the following versions: +To use this repository, you need to use the correct React-Native and RNOH versions. In addition, you need to use DevEco Studio and the ROM on your phone. + +Verified in the following versions. -1. RNOH: 0.72.20; SDK: HarmonyOS NEXT Developer Beta1; IDE: DevEco Studio 5.0.3.200; ROM: 3.0.0.18; -2. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.868; ROM: 6.0.0.112; +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; ### Permission Requirements diff --git a/en/react-native-securerandom.md b/en/react-native-securerandom.md index 9232f32f..4537cbdf 100644 --- a/en/react-native-securerandom.md +++ b/en/react-native-securerandom.md @@ -21,16 +21,14 @@ Please refer to the Releases page of the third-party library for the correspondi | Third-party Library Version | Release Information | Supported RN Version | | ---------- | ------------------------------------------------------------ | ---------- | -| 1.0.1@deprecated | [@react-native-oh-tpl/react-native-securerandom Releases(deprecated)](https://github.com/react-native-oh-library/react-native-securerandom/releases) | 0.72 | +| <= 1.0.1-0.0.2@deprecated | [@react-native-oh-tpl/react-native-securerandom Releases(deprecated)](https://github.com/react-native-oh-library/react-native-securerandom/releases) | 0.72 | | 1.0.2 | [@react-native-ohos/react-native-securerandom Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-securerandom/releases) | 0.72 | | 1.1.0 | [@react-native-ohos/react-native-securerandom Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-securerandom/releases) | 0.77 | -For older versions not published on npm, please refer to the [Installation Guide](/zh-cn/tgz-usage.md) to install the tgz package. +For older versions not published on npm, please refer to the [Installation Guide](/en/tgz-usage-en.md) to install the tgz package. Go to the project directory and execute the following instruction: - - #### npm @@ -173,7 +171,68 @@ Method 2: Directly link to the source code. > [!TIP] or details, see [Directly Linking Source Code](/en/link-source-code.md). -### 3. Introducing SecureRandomPackage to ArkTS +### 3.Configuring CMakeLists and Introducing SecureRandomPackage + +> If you are using version <= 1.0.1-0.0.2, please skip this chapter. + +Open `entry/src/main/cpp/CMakeLists.txt` and add the following code: + +```diff +project(rnapp) +cmake_minimum_required(VERSION 3.4.1) +set(CMAKE_SKIP_BUILD_RPATH TRUE) +set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}") +set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules") ++ set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules") +set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp") +set(LOG_VERBOSITY_LEVEL 1) +set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments") +set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie") +set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use +add_compile_definitions(WITH_HITRACE_SYSTRACE) + +add_subdirectory("${RNOH_CPP_DIR}" ./rn) + +# RNOH_BEGIN: manual_package_linking_1 +add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) ++ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-securerandom/src/main/cpp" ./secure_random) + +# RNOH_END: manual_package_linking_1 + +file(GLOB GENERATED_CPP_FILES "./generated/*.cpp") + +add_library(rnoh_app SHARED + ${GENERATED_CPP_FILES} + "./PackageProvider.cpp" + "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp" +) +target_link_libraries(rnoh_app PUBLIC rnoh) + +# RNOH_BEGIN: manual_package_linking_2 +target_link_libraries(rnoh_app PUBLIC rnoh_sample_package) ++ target_link_libraries(rnoh_app PUBLIC rnoh_secure_random) +# RNOH_END: manual_package_linking_2 +``` +打开 `entry/src/main/cpp/PackageProvider.cpp`,添加: + +```diff +#include "RNOH/PackageProvider.h" +#include "generated/RNOHGeneratedPackage.h" +#include "SamplePackage.h" ++ #include "SecureRandomPackage.h" + +using namespace rnoh; + +std::vector> PackageProvider::getPackages(Package::Context ctx) { + return { + std::make_shared(ctx), + std::make_shared(ctx), ++ std::make_shared(ctx) + }; +} +``` + +### 4. Introducing SecureRandomPackage to ArkTS Open the `entry/src/main/ets/RNPackagesFactory.ts` file and add the following code: @@ -189,7 +248,7 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { } ``` -### 4. Running +### 5. Running Click the `sync` button in the upper right corner. @@ -208,13 +267,11 @@ Then build and run the code. To use this repository, you need to use the correct React-Native and RNOH versions. In addition, you need to use DevEco Studio and the ROM on your phone. -Please refer to the Releases page of the third-party library for the corresponding version information +Verified in the following versions. -| Third-party Library Version | Release Information | Supported RN Version | -| ---------- | ------------------------------------------------------------ | ---------- | -| 1.0.1@deprecated | [@react-native-oh-tpl/react-native-securerandom Releases(deprecated)](https://github.com/react-native-oh-library/react-native-securerandom/releases) | 0.72 | -| 1.0.2 | [@react-native-ohos/react-native-securerandom Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-securerandom/releases) | 0.72 | -| 1.1.0 | [@react-native-ohos/react-native-securerandom Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-securerandom/releases) | 0.77 | +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; ## API diff --git a/en/react-native-shake.md b/en/react-native-shake.md index 328a4d6c..b030a681 100644 --- a/en/react-native-shake.md +++ b/en/react-native-shake.md @@ -20,11 +20,11 @@ Please refer to the Releases page of the third-party library for the correspondi | Third-party Library Version | Release Information | Supported RN Version | | ---------- | ------------------------------------------------------------ | ---------- | -| 5.6.2@deprecated | [@react-native-oh-tpl/react-native-shake Releases(deprecated)](https://github.com/react-native-oh-library/react-native-shake/releases) | 0.72 | +| <= 5.6.2-0.0.1@deprecated | [@react-native-oh-tpl/react-native-shake Releases(deprecated)](https://github.com/react-native-oh-library/react-native-shake/releases) | 0.72 | | 5.6.3 | [@react-native-ohos/react-native-shake Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-shake/releases) | 0.72 | | 6.0.2 | [@react-native-ohos/react-native-shake Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-shake/releases) | 0.77 | -For older versions not published on npm, please refer to the [Installation Guide](/zh-cn/tgz-usage.md) to install the tgz package. +For older versions not published on npm, please refer to the [Installation Guide](/en/tgz-usage-en.md) to install the tgz package. Go to the project directory and execute the following instruction: @@ -169,7 +169,7 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { ### 4. Configure CMakeLists and import ShakePackge -> [!TIP] If using version 5.6.3, please configure CMakeLists and import ShakePackge +> If you are using version <= 5.6.2-0.0.1, please skip this chapter. open `entry/src/main/cpp/CMakeLists.txt`,add: @@ -237,18 +237,11 @@ Then build and run the code. To use this repository, you need to use the correct React-Native and RNOH versions. In addition, you need to use DevEco Studio and the ROM on your phone. -Please refer to the Releases page of the third-party library for the corresponding version information - -| Third-party Library Version | Release Information | Supported RN Version | -| ---------- | ------------------------------------------------------------ | ---------- | -| 5.6.2@deprecated | [@react-native-oh-tpl/react-native-shake Releases(deprecated)](https://github.com/react-native-oh-library/react-native-shake/releases) | 0.72 | -| 5.6.3 | [@react-native-ohos/react-native-shake Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-shake/releases) | 0.72 | -| 6.0.2 | [@react-native-ohos/react-native-shake Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-shake/releases) | 0.77 | - -The content of this document has been verified based on the following versions: +Verified in the following versions. -1. RNOH: 0.72.98; SDK: HarmonyOS-5.0.0(API12); IDE: DevEco Studio 5.0.3.906; ROM: NEXT.0.0.71; -2. RNOH:0.77.18; SDK:HarmonyOS 6.0.0.47 (API Version 20); IDE:DevEco Studio 6.0.0.858; ROM:6.0.0.107; +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; ### Permission Requirements diff --git a/en/react-native-ssl-pinning.md b/en/react-native-ssl-pinning.md index 4e8e90b9..c70bf4ea 100644 --- a/en/react-native-ssl-pinning.md +++ b/en/react-native-ssl-pinning.md @@ -24,7 +24,7 @@ Please refer to the Releases page of the third-party library for the correspondi | 1.5.8 | [@react-native-ohos/react-native-ssl-pinning Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-ssl-pinning/releases) | 0.72 | | 1.6.0 | [@react-native-ohos/react-native-ssl-pinning Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-ssl-pinning/releases) | 0.77 | -For older versions not published on npm, please refer to the [Installation Guide](/zh-cn/tgz-usage.md) to install the tgz package. +For older versions not published on npm, please refer to the [Installation Guide](/en/tgz-usage-en.md) to install the tgz package. Go to the project directory and execute the following instruction: @@ -296,7 +296,68 @@ Method 2: Directly link to the source code. > [!TIP] For details, see [Directly Linking Source Code](/en/link-source-code.md). -### 3.Introducing SslPinningPackage Package to ArkTS +### 3.Configuring CMakeLists and Introducing RNGetRandomValuesPackage + +> If you are using version <= 1.5.7-0.0.2, please skip this chapter. + +Open `entry/src/main/cpp/CMakeLists.txt` and add the following code: + +```diff +project(rnapp) +cmake_minimum_required(VERSION 3.4.1) +set(CMAKE_SKIP_BUILD_RPATH TRUE) +set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}") +set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules") ++ set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules") +set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp") +set(LOG_VERBOSITY_LEVEL 1) +set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments") +set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie") +set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use +add_compile_definitions(WITH_HITRACE_SYSTRACE) + +add_subdirectory("${RNOH_CPP_DIR}" ./rn) + +# RNOH_BEGIN: manual_package_linking_1 +add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) ++ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-ssl-pinning/src/main/cpp" ./ssl_pinning) + +# RNOH_END: manual_package_linking_1 + +file(GLOB GENERATED_CPP_FILES "./generated/*.cpp") + +add_library(rnoh_app SHARED + ${GENERATED_CPP_FILES} + "./PackageProvider.cpp" + "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp" +) +target_link_libraries(rnoh_app PUBLIC rnoh) + +# RNOH_BEGIN: manual_package_linking_2 +target_link_libraries(rnoh_app PUBLIC rnoh_sample_package) ++ target_link_libraries(rnoh_app PUBLIC rnoh_ssl_pinning) +# RNOH_END: manual_package_linking_2 +``` +Open `entry/src/main/cpp/PackageProvider.cpp`, and add the following code: + +```diff +#include "RNOH/PackageProvider.h" +#include "generated/RNOHGeneratedPackage.h" +#include "SamplePackage.h" ++ #include "SslPinningPackage.h" + +using namespace rnoh; + +std::vector> PackageProvider::getPackages(Package::Context ctx) { + return { + std::make_shared(ctx), + std::make_shared(ctx), ++ std::make_shared(ctx) + }; +} +``` + +### 4.Introducing SslPinningPackage Package to ArkTS Open the entry/src/main/ets/RNPackagesFactory.ts file and add the following code: @@ -312,7 +373,7 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { } ``` -### 4.Running +### 5.Running Click the sync button in the upper right corner. @@ -328,15 +389,14 @@ Then build and run the code. ## Constraints ### Compatibility + To use this repository, you need to use the correct React-Native and RNOH versions. In addition, you need to use DevEco Studio and the ROM on your phone. -Please refer to the Releases page of the third-party library for the corresponding version information +Verified in the following versions. -| Third-party Library Version | Release Information | Supported RN Version | -| ---------- | ------------------------------------------------------------ | ---------- | -| 1.5.7@deprecated | [@react-native-oh-tpl/react-native-ssl-pinning Releases(deprecated)](https://github.com/react-native-oh-library/react-native-ssl-pinning/releases) | 0.72 | -| 1.5.8 | [@react-native-ohos/react-native-ssl-pinning Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-ssl-pinning/releases) | 0.72 | -| 1.6.0 | [@react-native-ohos/react-native-ssl-pinning Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-ssl-pinning/releases) | 0.77 | +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; ### Permission Requirements diff --git a/zh-cn/react-native-audio.md b/zh-cn/react-native-audio.md index e65f19ef..76a49fc0 100644 --- a/zh-cn/react-native-audio.md +++ b/zh-cn/react-native-audio.md @@ -12,7 +12,7 @@ | 三方库版本 | 发布信息 | 支持RN版本 | |--------| ------------------------------------------------------------ | ---------- | -| 4.2.3@deprecated | [@react-native-oh-tpl/react-native-audio Releases(deprecated)](https://github.com/react-native-oh-library/react-native-audio/releases) | 0.72 | +| <= 4.3.1-0.1.0@deprecated | [@react-native-oh-tpl/react-native-audio Releases(deprecated)](https://github.com/react-native-oh-library/react-native-audio/releases) | 0.72 | | 4.2.4 | [@react-native-ohos/react-native-audio Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-audio/releases) | 0.72 | | 4.3.0 | [@react-native-ohos/react-native-audio Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-audio/releases) | 0.77 | @@ -248,7 +248,7 @@ ohpm install ### 2.3 配置 CMakeLists 和引入 AudioPackage - > **[!TIP] 版本 4.2.4 及以上需要.** +> 若使用的是 <= 4.3.1-0.1.0 版本,请跳过本章。 打开 `entry/src/main/cpp/CMakeLists.txt`,添加: @@ -316,8 +316,10 @@ ohpm install 在以下版本验证通过: -1. RNOH:0.72.96; SDK:HarmonyOS 5.1.0.150 (API Version 12); IDE:DevEco Studio 5.1.1.830; ROM:5.1.0.150; -2. RNOH:0.77.18; SDK:HarmonyOS 5.1.0.150 (API Version 12); IDE:DevEco Studio 5.1.1.830; ROM:5.1.0.150; +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; + ## 4. API diff --git a/zh-cn/react-native-get-random-values.md b/zh-cn/react-native-get-random-values.md index 96360825..9bb52d61 100644 --- a/zh-cn/react-native-get-random-values.md +++ b/zh-cn/react-native-get-random-values.md @@ -21,7 +21,7 @@ | 三方库版本 | 发布信息 | 支持RN版本 | | ---------- | ------------------------------------------------------------ | ---------- | -| 1.11.0@deprecated | [@react-native-oh-tpl/react-native-get-random-values Releases(deprecated)](https://github.com/react-native-oh-library/react-native-get-random-values/releases) | 0.72 | +| <= 1.11.0-0.0.1@deprecated | [@react-native-oh-tpl/react-native-get-random-values Releases(deprecated)](https://github.com/react-native-oh-library/react-native-get-random-values/releases) | 0.72 | | 1.11.1 | [@react-native-ohos/react-native-get-random-values Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-get-random-values/releases) | 0.72 | | 1.12.0 | [@react-native-ohos/react-native-get-random-values Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-get-random-values/releases) | 0.77 | @@ -139,7 +139,68 @@ ohpm install > [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](/zh-cn/link-source-code.md) -### 3.在 ArkTs 侧引入 RNGetRandomValuesPackage +### 3.配置 CMakeLists 和引入 GetRandomValuesPackage + +> 若使用的是 <= 1.11.0-0.0.1 版本,请跳过本章。 + +打开 `entry/src/main/cpp/CMakeLists.txt`,添加: + +```diff +project(rnapp) +cmake_minimum_required(VERSION 3.4.1) +set(CMAKE_SKIP_BUILD_RPATH TRUE) +set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}") +set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules") ++ set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules") +set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp") +set(LOG_VERBOSITY_LEVEL 1) +set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments") +set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie") +set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use +add_compile_definitions(WITH_HITRACE_SYSTRACE) + +add_subdirectory("${RNOH_CPP_DIR}" ./rn) + +# RNOH_BEGIN: manual_package_linking_1 +add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) ++ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-get-random-values/src/main/cpp" ./get_random_values) + +# RNOH_END: manual_package_linking_1 + +file(GLOB GENERATED_CPP_FILES "./generated/*.cpp") + +add_library(rnoh_app SHARED + ${GENERATED_CPP_FILES} + "./PackageProvider.cpp" + "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp" +) +target_link_libraries(rnoh_app PUBLIC rnoh) + +# RNOH_BEGIN: manual_package_linking_2 +target_link_libraries(rnoh_app PUBLIC rnoh_sample_package) ++ target_link_libraries(rnoh_app PUBLIC rnoh_get_random_values) +# RNOH_END: manual_package_linking_2 +``` +打开 `entry/src/main/cpp/PackageProvider.cpp`,添加: + +```diff +#include "RNOH/PackageProvider.h" +#include "generated/RNOHGeneratedPackage.h" +#include "SamplePackage.h" ++ #include "GetRandomValuesPackage.h" + +using namespace rnoh; + +std::vector> PackageProvider::getPackages(Package::Context ctx) { + return { + std::make_shared(ctx), + std::make_shared(ctx), ++ std::make_shared(ctx) + }; +} +``` + +### 4.在 ArkTs 侧引入 RNGetRandomValuesPackage 打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: @@ -155,7 +216,7 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { } ``` -### 4.运行 +### 5.运行 点击右上角的 `sync` 按钮 @@ -172,18 +233,13 @@ ohpm install ### 兼容性 -请到三方库的 Releases 发布地址查看配套的版本信息: - -| 三方库版本 | 发布信息 | 支持RN版本 | -| ---------- | ------------------------------------------------------------ | ---------- | -| 1.11.0@deprecated | [@react-native-oh-tpl/react-native-get-random-values Releases(deprecated)](https://github.com/react-native-oh-library/react-native-get-random-values/releases) | 0.72 | -| 1.11.1 | [@react-native-ohos/react-native-get-random-values Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-get-random-values/releases) | 0.72 | -| 1.12.0 | [@react-native-ohos/react-native-get-random-values Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-get-random-values/releases) | 0.77 | +要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -本文档内容基于以下版本验证通过: +在以下版本验证通过: -1. RNOH: 0.72.20-CAPI; SDK: HarmonyOS NEXT Developer Preview2; IDE: DevEco Studio 4.1.3.700; ROM: 3.0.0.19; -2. RNOH:0.77.18; SDK:HarmonyOS 6.0.0.47 (API Version 20); IDE:DevEco Studio 6.0.0.858; ROM:6.0.0.107; +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; ## 静态方法 diff --git a/zh-cn/react-native-image-colors.md b/zh-cn/react-native-image-colors.md index a03dd7fa..2315bd4b 100644 --- a/zh-cn/react-native-image-colors.md +++ b/zh-cn/react-native-image-colors.md @@ -19,7 +19,7 @@ | 三方库版本 | 发布信息 | 支持RN版本 | | ---------- | ------------------------------------------------------------ | ---------- | -| 2.4.0@deprecated | [@react-native-oh-tpl/react-native-image-colors Releases(deprecated)](https://github.com/react-native-oh-library/react-native-image-colors/releases) | 0.72 | +| <= 2.4.0-0.0.7@deprecated | [@react-native-oh-tpl/react-native-image-colors Releases(deprecated)](https://github.com/react-native-oh-library/react-native-image-colors/releases) | 0.72 | | 2.4.1 | [@react-native-ohos/react-native-image-colors Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-image-colors/releases) | 0.72 | | 2.5.1 | [@react-native-ohos/react-native-image-colors Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-image-colors/releases) | 0.77 | @@ -265,11 +265,11 @@ ohpm install ### 3.配置CMakeLists 和引入 ImageColorsPackage -> [!TIP] 若使用的是 2.4.0 版本,请跳过本章 +> 若使用的是 <= 2.4.0-0.0.7 版本,请跳过本章 打开 `entry/src/main/cpp/CMakeLists.txt`,添加: -```cmake +```diff project(rnapp) cmake_minimum_required(VERSION 3.4.1) set(CMAKE_SKIP_BUILD_RPATH TRUE) @@ -288,6 +288,7 @@ add_subdirectory("${RNOH_CPP_DIR}" ./rn) # RNOH_BEGIN: manual_package_linking_1 add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) + add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-image-colors/src/main/cpp" ./image-colors) + # RNOH_END: manual_package_linking_1 file(GLOB GENERATED_CPP_FILES "./generated/*.cpp") @@ -304,10 +305,9 @@ target_link_libraries(rnoh_app PUBLIC rnoh_sample_package) + target_link_libraries(rnoh_app PUBLIC rnoh_image_colors) # RNOH_END: manual_package_linking_2 ``` - 打开 `entry/src/main/cpp/PackageProvider.cpp`,添加: -```c++ +```diff #include "RNOH/PackageProvider.h" #include "generated/RNOHGeneratedPackage.h" #include "SamplePackage.h" @@ -317,14 +317,13 @@ using namespace rnoh; std::vector> PackageProvider::getPackages(Package::Context ctx) { return { - std::make_shared(ctx), - std::make_shared(ctx), -+ std::make_shared(ctx) + std::make_shared(ctx), + std::make_shared(ctx), ++ std::make_shared(ctx) }; } ``` - ### 4.在 ArkTs 侧引入 RNImageColorsPackage 打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: @@ -358,10 +357,13 @@ ohpm install ### 兼容性 -在以下版本验证通过 +要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 + +在以下版本验证通过: -1. RNOH:0.72.33; SDK:OpenHarmony 5.0.0.71(API Version 12 Release); IDE:DevEco Studio 5.0.3.900; ROM:NEXT.0.0.71; -2. RNOH:0.77.17; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.868; ROM: 6.0.0.112; +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; ## API diff --git a/zh-cn/react-native-image-crop-picker.md b/zh-cn/react-native-image-crop-picker.md index fcf5dc80..578a9bfb 100644 --- a/zh-cn/react-native-image-crop-picker.md +++ b/zh-cn/react-native-image-crop-picker.md @@ -6,15 +6,17 @@ > [!Tip] [Github 地址](https://github.com/react-native-oh-library/react-native-image-crop-picker) -该第三方库的仓库已迁移至 Gitcode,且支持直接从 npm 下载,新的包名为:`@react-native-ohos/react-native-image-crop-picker`,具体版本所属关系如下: +## 1.安装与使用 + +请到三方库的 Releases 发布地址查看配套的版本信息: | 三方库版本 | 发布信息 | 支持RN版本 | |--------| ------------------------------------------------------------ | ---------- | -| 0.40.4@deprecated | [@react-native-oh-tpl/react-native-image-crop-picker Releases(deprecated)](https://github.com/react-native-oh-library/react-native-image-crop-picker/releases) | 0.72 | +| <= 0.40.3-0.0.14@deprecated | [@react-native-oh-tpl/react-native-image-crop-picker Releases(deprecated)](https://github.com/react-native-oh-library/react-native-image-crop-picker/releases) | 0.72 | | 0.40.5 | [@react-native-ohos/react-native-image-crop-picker Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-image-crop-picker/releases) | 0.72 | | 0.50.2 | [@react-native-ohos/react-native-image-crop-picker Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-image-crop-picker/releases) | 0.77 | -## 1.安装与使用 +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 进入到工程目录并输入以下命令: @@ -789,6 +791,9 @@ export default ImageCropPickDemo; ## 2. Manual Link +Version >= @react-native-ohos/react-native-image-crop-picker@0.40.5,已支持 Autolink,无需手动配置(仍需手动配置的内容已在对应标题处标记),目前只支持72框架。 +Autolink框架指导文档:https://gitcode.com/openharmony-sig/ohos_react_native/blob/master/docs/zh-cn/Autolinking.md + 此步骤为手动配置原生依赖项的指导。 首先需要使用 DevEco Studio 打开项目里的 HarmonyOS 工程 `harmony`。 @@ -844,7 +849,7 @@ ohpm install ### 2.3. 配置 CMakeLists 和引入 ImageCropPickerPackage -> [!TIP] 版本 `0.77` 及以上需要 +> 若使用的是 <= 0.40.3-0.0.14 版本,请跳过本章。 打开 `entry/src/main/cpp/CMakeLists.txt`,添加: @@ -910,7 +915,7 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { } ``` -### 2.5. 配置Entry +### 2.5. 配置Entry(该模块始终需要手动配置) **(1)在 entry/src/main/ets/entryability 下创建 ImageEditAbility.ets** @@ -1029,11 +1034,13 @@ ohpm install ### 3.1. 兼容性 -在下述版本验证通过: +要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -RNOH:0.72.20; SDK:HarmonyOS NEXT Developer Beta1; IDE:DevEco Studio 5.0.3.200; ROM:3.0.0.18; +在以下版本验证通过: -RNOH:0.77.18; SDK:HarmonyOS 6.0.0 Release SDK;IDE:DevEco Studio 6.0.0.868; ROM:6.0.0.112; +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; ## 4. API diff --git a/zh-cn/react-native-image-rotate.md b/zh-cn/react-native-image-rotate.md index 7d9a3b7a..0a2e3295 100644 --- a/zh-cn/react-native-image-rotate.md +++ b/zh-cn/react-native-image-rotate.md @@ -21,7 +21,7 @@ | 三方库版本 | 发布信息 | 支持RN版本 | |-------| ------------------------------------------------------------ | ---------- | -| 2.1.0@deprecated | [@react-native-oh-tpl/react-native-image-rotate Releases(deprecated)](https://github.com/react-native-oh-library/react-native-image-rotate/releases) | 0.72 | +| <= 2.1.0-0.0.1@deprecated | [@react-native-oh-tpl/react-native-image-rotate Releases(deprecated)](https://github.com/react-native-oh-library/react-native-image-rotate/releases) | 0.72 | | 2.1.1 | [@react-native-ohos/react-native-image-rotate Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-image-rotate/releases) | 0.72 | | 2.2.0 | [@react-native-ohos/react-native-image-rotate Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-image-rotate/releases) | 0.77 | @@ -141,6 +141,8 @@ const styles = StyleSheet.create({ ## 使用 Codegen +Version >= @react-native-ohos/react-native-inappbrowser@2.1.1,已适配codegen-lib生成桥接代码。 + 本库已经适配了 `Codegen` ,在使用前需要主动执行生成三方库桥接代码,详细请参考[ Codegen 使用文档](/zh-cn/codegen.md)。 ## Link @@ -196,7 +198,68 @@ ohpm install > [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](/zh-cn/link-source-code.md) -### 3.在 ArkTs 侧引入 RNImageRotatePackage +### 3.配置 CMakeLists 和引入 ImageRotatePackage + +> 若使用的是 <= 2.1.0-0.0.1 版本,请跳过本章。 + +打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: + +```diff +project(rnapp) +cmake_minimum_required(VERSION 3.4.1) +set(CMAKE_SKIP_BUILD_RPATH TRUE) +set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}") +set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules") ++ set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules") +set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp") +set(LOG_VERBOSITY_LEVEL 1) +set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments") +set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie") +set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use +add_compile_definitions(WITH_HITRACE_SYSTRACE) + +add_subdirectory("${RNOH_CPP_DIR}" ./rn) + +# RNOH_BEGIN: manual_package_linking_1 +add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) ++ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-image-rotate/src/main/cpp" ./imageRotate) + +# RNOH_END: manual_package_linking_1 + +file(GLOB GENERATED_CPP_FILES "./generated/*.cpp") + +add_library(rnoh_app SHARED + ${GENERATED_CPP_FILES} + "./PackageProvider.cpp" + "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp" +) +target_link_libraries(rnoh_app PUBLIC rnoh) + +# RNOH_BEGIN: manual_package_linking_2 +target_link_libraries(rnoh_app PUBLIC rnoh_sample_package) ++ target_link_libraries(rnoh_app PUBLIC rnoh_image_rotate) +# RNOH_END: manual_package_linking_2 +``` +打开 `entry/src/main/cpp/PackageProvider.cpp`,添加: + +```diff +#include "RNOH/PackageProvider.h" +#include "generated/RNOHGeneratedPackage.h" +#include "SamplePackage.h" ++ #include "ImageRotatePackage.h" + +using namespace rnoh; + +std::vector> PackageProvider::getPackages(Package::Context ctx) { + return { + std::make_shared(ctx), + std::make_shared(ctx), ++ std::make_shared(ctx) + }; +} +``` + +### 4.在 ArkTs 侧引入 RNImageRotatePackage 打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: @@ -213,7 +276,7 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { } ``` -### 4.运行 +### 5.运行 点击右上角的 `sync` 按钮 @@ -232,18 +295,11 @@ ohpm install 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -请到三方库的 Releases 发布地址查看配套的版本信息: - -| 三方库版本 | 发布信息 | 支持RN版本 | -|-------| ------------------------------------------------------------ | ---------- | -| 2.1.0@deprecated | [@react-native-oh-tpl/react-native-image-rotate Releases(deprecated)](https://github.com/react-native-oh-library/react-native-image-rotate/releases) | 0.72 | -| 2.1.1 | [@react-native-ohos/react-native-image-rotate Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-image-rotate/releases) | 0.72 | -| 2.2.0 | [@react-native-ohos/react-native-image-rotate Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-image-rotate/releases) | 0.77 | - -本文档内容基于以下版本验证通过: +在以下版本验证通过: -1. RNOH: 0.72.98; SDK: HarmonyOS-5.0.0(API12); IDE: DevEco Studio 5.0.3.906; ROM: NEXT.0.0.71; -2. RNOH:0.77.18; SDK:HarmonyOS 6.0.0.47 (API Version 20); IDE:DevEco Studio 6.0.0.858; ROM:6.0.0.107; +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; ## 静态方法 diff --git a/zh-cn/react-native-inappbrowser.md b/zh-cn/react-native-inappbrowser.md index 3f5bac20..40a1aa63 100644 --- a/zh-cn/react-native-inappbrowser.md +++ b/zh-cn/react-native-inappbrowser.md @@ -14,20 +14,22 @@ > [!TIP] [Github 地址](https://github.com/react-native-oh-library/react-native-inappbrowser) +## 安装与使用 + 请到三方库的 Releases 发布地址查看配套的版本信息: | 三方库版本 | 发布信息 | 支持RN版本 | |-------| ------------------------------------------------------------ | ---------- | -| 3.7.0@deprecated | [@react-native-oh-tpl/react-native-inappbrowser-reborn Releases(deprecated)](https://github.com/react-native-oh-library/react-native-inappbrowser/releases) | 0.72 | +| <= 3.7.0-0.0.4@deprecated | [@react-native-oh-tpl/react-native-inappbrowser-reborn Releases(deprecated)](https://github.com/react-native-oh-library/react-native-inappbrowser/releases) | 0.72 | | 3.7.1 | [@react-native-ohos/react-native-inappbrowser-reborn Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-inappbrowser/releases) | 0.72 | | 3.8.0 | [@react-native-ohos/react-native-inappbrowser-reborn Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-inappbrowser/releases) | 0.77 | 对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 -## 安装与使用 - 进入到工程目录并输入以下命令: + + #### **npm** ``` @@ -271,7 +273,7 @@ Version >= @react-native-ohos/react-native-inappbrowser@3.7.1,已适配codegen ## Link -Version >= @react-native-ohos/react-native-localize@3.7.1,已支持 Autolink,无需手动配置,目前只支持72框架。 Autolink框架指导文档:https://gitcode.com/openharmony-sig/ohos_react_native/blob/master/docs/zh-cn/Autolinking.md +Version >= @react-native-ohos/react-native-localize@3.7.1,已支持 Autolink,无需手动配置(仍需手动配置的内容已在对应标题处标记),目前只支持72框架。 Autolink框架指导文档:https://gitcode.com/openharmony-sig/ohos_react_native/blob/master/docs/zh-cn/Autolinking.md 此步骤为手动配置原生依赖项的指导。 @@ -287,7 +289,7 @@ Version >= @react-native-ohos/react-native-localize@3.7.1,已支持 Autolink } ``` -### 1.配置Entry +### 1.配置Entry(该模块始终需要手动配置) **1.在 entry/src/main/ets/entryability 下创建 BrowserManagerAbility.ets** @@ -434,7 +436,7 @@ ohpm install ### 3.配置CMakeLists 和引入 InappbrowserRebornPackage -> [!TIP] 若使用的是 3.7.0 版本,请跳过本章 +> 若使用的是 <= 3.7.0-0.0.4 版本,请跳过本章。 打开 `entry/src/main/cpp/CMakeLists.txt`,添加: @@ -456,7 +458,7 @@ add_subdirectory("${RNOH_CPP_DIR}" ./rn) # RNOH_BEGIN: manual_package_linking_1 add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) -+ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-inappbrowser-reborn/src/main/cpp" ./inappbrowser-reborn) ++ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-inappbrowser-reborn/src/main/cpp" ./inappbrowser) # RNOH_END: manual_package_linking_1 file(GLOB GENERATED_CPP_FILES "./generated/*.cpp") @@ -470,7 +472,7 @@ target_link_libraries(rnoh_app PUBLIC rnoh) # RNOH_BEGIN: manual_package_linking_2 target_link_libraries(rnoh_app PUBLIC rnoh_sample_package) -+ target_link_libraries(rnoh_app PUBLIC rnoh_inappbrowser_reborn) ++ target_link_libraries(rnoh_app PUBLIC rnoh_inappbrowser) # RNOH_END: manual_package_linking_2 ``` @@ -480,7 +482,7 @@ target_link_libraries(rnoh_app PUBLIC rnoh_sample_package) #include "RNOH/PackageProvider.h" #include "generated/RNOHGeneratedPackage.h" #include "SamplePackage.h" -+ #include "InappbrowserRebornPackage.h" ++ #include "InAppBrowserPackage.h" using namespace rnoh; @@ -488,7 +490,7 @@ std::vector> PackageProvider::getPackages(Package::Cont return { std::make_shared(ctx), std::make_shared(ctx), -+ std::make_shared(ctx) ++ std::make_shared(ctx) }; } ``` @@ -526,11 +528,13 @@ ohpm install ### 兼容性 -本文档内容基于以下版本验证通过: +要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -1. RNOH: 0.72.20; SDK: HarmonyOS NEXT Developer Beta1; IDE: DevEco Studio 5.0.3.200; ROM: 3.0.0.18; -2. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.868; ROM: 6.0.0.112; +在以下版本验证通过: +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; ## API > [!TIP] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。 diff --git a/zh-cn/react-native-network-info.md b/zh-cn/react-native-network-info.md index 82cd1303..88929798 100644 --- a/zh-cn/react-native-network-info.md +++ b/zh-cn/react-native-network-info.md @@ -20,10 +20,12 @@ | 三方库版本 | 发布信息 | 支持RN版本 | | ---------- | ------------------------------------------------------------ | ---------- | -| 5.2.1@deprecated | [@react-native-oh-tpl/react-native-network-info Releases(deprecated)](https://github.com/react-native-oh-library/react-native-network-info/releases) | 0.72 | +| <= 5.2.1-0.0.1@deprecated | [@react-native-oh-tpl/react-native-network-info Releases(deprecated)](https://github.com/react-native-oh-library/react-native-network-info/releases) | 0.72 | | 5.2.2 | [@react-native-ohos/react-native-network-info Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-network-info/releases) | 0.72 | | 5.3.0 | [@react-native-ohos/react-native-network-info Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-network-info/releases) | 0.77 | +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 + 进入到工程目录并输入以下命令: @@ -215,7 +217,7 @@ ohpm install ### 3.配置 CMakeLists 和引入 RNOrientationPackage -> [!TIP] 版本 `5.3.0` 及以上需要 +> 若使用的是 <= 5.2.1-0.0.1 版本,请跳过本章。 打开 `entry/src/main/cpp/CMakeLists.txt`,添加: @@ -300,8 +302,9 @@ ohpm install 在以下版本验证通过: -1. RNOH:0.72.96; SDK:HarmonyOS 5.1.0.150 (API Version 12); IDE:DevEco Studio 5.1.1.830; ROM:5.1.0.150; -2. RNOH:0.77.18; SDK:HarmonyOS 5.1.0.150 (API Version 12); IDE:DevEco Studio 5.1.1.830; ROM:5.1.0.150; +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; ### 权限要求 diff --git a/zh-cn/react-native-print.md b/zh-cn/react-native-print.md index e034836f..40157abe 100644 --- a/zh-cn/react-native-print.md +++ b/zh-cn/react-native-print.md @@ -14,18 +14,18 @@ > [!TIP] [Github 地址](https://github.com/react-native-oh-library/react-native-print) +## 安装与使用 + 请到三方库的 Releases 发布地址查看配套的版本信息: | 三方库版本 | 发布信息 | 支持RN版本 | |--------| ------------------------------------------------------------ | ---------- | -| 0.11.0@deprecated | [@react-native-oh-tpl/react-native-print Releases(deprecated)](https://github.com/react-native-oh-library/react-native-print/releases) | 0.72 | +| <= 0.11.0-0.0.3@deprecated | [@react-native-oh-tpl/react-native-print Releases(deprecated)](https://github.com/react-native-oh-library/react-native-print/releases) | 0.72 | | 0.11.1 | [@react-native-ohos/react-native-print Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-print/releases) | 0.72 | | 0.12.0 | [@react-native-ohos/react-native-print Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-print/releases) | 0.77 | 对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 -## 安装与使用 - 进入到工程目录并输入以下命令: @@ -118,7 +118,7 @@ export default function RNPrint(): JSX.Element { ## 使用 Codegen -[!TIP] V0.11.1 不需要执行Codegen +Version >= @react-native-ohos/react-native-inappbrowser@0.11.1,已适配codegen-lib生成桥接代码。 本库已经适配了 `Codegen` ,在使用前需要主动执行生成三方库桥接代码,详细请参考[ Codegen 使用文档](/zh-cn/codegen.md)。 @@ -177,7 +177,7 @@ ohpm install ### 3.配置CMakeLists 和引入 PrintPackage -> [!TIP] 若使用的是 0.11.0 版本,请跳过本章 +> 若使用的是 <= 0.11.0-0.0.3 版本,请跳过本章。 打开 `entry/src/main/cpp/CMakeLists.txt`,添加: @@ -269,10 +269,13 @@ ohpm install ### 兼容性 -本文档内容基于以下版本验证通过: +要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 + +在以下版本验证通过: -1. RNOH: 0.72.20; SDK: HarmonyOS NEXT Developer Beta1; IDE: DevEco Studio 5.0.3.200; ROM: 3.0.0.18; -2. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.868; ROM: 6.0.0.112; +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; ### 权限要求 diff --git a/zh-cn/react-native-securerandom.md b/zh-cn/react-native-securerandom.md index 15d05bc8..a02bb834 100644 --- a/zh-cn/react-native-securerandom.md +++ b/zh-cn/react-native-securerandom.md @@ -21,7 +21,7 @@ | 三方库版本 | 发布信息 | 支持RN版本 | | ------------- | ------------------------------------------------------------ | ---------- | -| 1.0.1@deprecated | [@react-native-oh-tpl/react-native-securerandom Releases(deprecated)](https://github.com/react-native-oh-library/react-native-securerandom/releases) | 0.72 | +| <= 1.0.1-0.0.2@deprecated | [@react-native-oh-tpl/react-native-securerandom Releases(deprecated)](https://github.com/react-native-oh-library/react-native-securerandom/releases) | 0.72 | | 1.0.2 | [@react-native-ohos/react-native-securerandom Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-securerandom/releases) | 0.72 | | 1.1.0 | [@react-native-ohos/react-native-securerandom Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-securerandom/releases) | 0.77 | @@ -29,7 +29,6 @@ 进入到工程目录并输入以下命令: - #### npm @@ -148,7 +147,68 @@ ohpm install > [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](/zh-cn/link-source-code.md) -### 3.在 ArkTs 侧引入 SecureRandomPackage +### 3.配置 CMakeLists 和引入 SecureRandomPackage + +> 若使用的是 <= 1.0.1-0.0.2 版本,请跳过本章。 + +打开 `entry/src/main/cpp/CMakeLists.txt`,添加: + +```diff +project(rnapp) +cmake_minimum_required(VERSION 3.4.1) +set(CMAKE_SKIP_BUILD_RPATH TRUE) +set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}") +set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules") ++ set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules") +set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp") +set(LOG_VERBOSITY_LEVEL 1) +set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments") +set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie") +set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use +add_compile_definitions(WITH_HITRACE_SYSTRACE) + +add_subdirectory("${RNOH_CPP_DIR}" ./rn) + +# RNOH_BEGIN: manual_package_linking_1 +add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) ++ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-securerandom/src/main/cpp" ./secure_random) + +# RNOH_END: manual_package_linking_1 + +file(GLOB GENERATED_CPP_FILES "./generated/*.cpp") + +add_library(rnoh_app SHARED + ${GENERATED_CPP_FILES} + "./PackageProvider.cpp" + "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp" +) +target_link_libraries(rnoh_app PUBLIC rnoh) + +# RNOH_BEGIN: manual_package_linking_2 +target_link_libraries(rnoh_app PUBLIC rnoh_sample_package) ++ target_link_libraries(rnoh_app PUBLIC rnoh_secure_random) +# RNOH_END: manual_package_linking_2 +``` +打开 `entry/src/main/cpp/PackageProvider.cpp`,添加: + +```diff +#include "RNOH/PackageProvider.h" +#include "generated/RNOHGeneratedPackage.h" +#include "SamplePackage.h" ++ #include "SecureRandomPackage.h" + +using namespace rnoh; + +std::vector> PackageProvider::getPackages(Package::Context ctx) { + return { + std::make_shared(ctx), + std::make_shared(ctx), ++ std::make_shared(ctx) + }; +} +``` + +### 4.在 ArkTs 侧引入 SecureRandomPackage 打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: @@ -164,7 +224,7 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { } ``` -### 4.运行 +### 5.运行 点击右上角的 `sync` 按钮 @@ -183,13 +243,11 @@ ohpm install 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -请到三方库的 Releases 发布地址查看配套的版本信息: +在以下版本验证通过: -| 三方库版本 | 发布信息 | 支持RN版本 | -| ------------- | ------------------------------------------------------------ | ---------- | -| 1.0.1@deprecated | [@react-native-oh-tpl/react-native-securerandom Releases(deprecated)](https://github.com/react-native-oh-library/react-native-securerandom/releases) | 0.72 | -| 1.0.2 | [@react-native-ohos/react-native-securerandom Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-securerandom/releases) | 0.72 | -| 1.1.0 | [@react-native-ohos/react-native-securerandom Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-securerandom/releases) | 0.77 | +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; ## API diff --git a/zh-cn/react-native-shake.md b/zh-cn/react-native-shake.md index 6e00ed62..8516bd0e 100644 --- a/zh-cn/react-native-shake.md +++ b/zh-cn/react-native-shake.md @@ -20,7 +20,7 @@ | 三方库版本 | 发布信息 | 支持RN版本 | | ------------- | ------------------------------------------------------------ | ---------- | -| 5.6.2@deprecated | [@react-native-oh-tpl/react-native-shake Releases(deprecated)](https://github.com/react-native-oh-library/react-native-shake/releases) | 0.72 | +| <= 5.6.2-0.0.1@deprecated | [@react-native-oh-tpl/react-native-shake Releases(deprecated)](https://github.com/react-native-oh-library/react-native-shake/releases) | 0.72 | | 5.6.3 | [@react-native-ohos/react-native-shake Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-shake/releases) | 0.72 | | 6.0.2 | [@react-native-ohos/react-native-shake Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-shake/releases) | 0.77 | @@ -173,7 +173,7 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { ### 4.配置 CMakeLists 和引入 ShakePackge -> [!TIP] V5.6.3 需要配置 CMakeLists 和引入 ShakePackge。 +> 若使用的是 <= 5.6.2-0.0.1 版本,请跳过本章。 打开 `entry/src/main/cpp/CMakeLists.txt`,添加: @@ -239,21 +239,13 @@ ohpm install ### 兼容性 - 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -请到三方库的 Releases 发布地址查看配套的版本信息: - -| 三方库版本 | 发布信息 | 支持RN版本 | -| ------------- | ------------------------------------------------------------ | ---------- | -| 5.6.2@deprecated | [@react-native-oh-tpl/react-native-shake Releases(deprecated)](https://github.com/react-native-oh-library/react-native-shake/releases) | 0.72 | -| 5.6.3 | [@react-native-ohos/react-native-shake Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-shake/releases) | 0.72 | -| 6.0.2 | [@react-native-ohos/react-native-shake Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-shake/releases) | 0.77 | - -本文档内容基于以下版本验证通过: +在以下版本验证通过: -1. RNOH: 0.72.98; SDK: HarmonyOS-5.0.0(API12); IDE: DevEco Studio 5.0.3.906; ROM: NEXT.0.0.71; -2. RNOH:0.77.18; SDK:HarmonyOS 6.0.0.47 (API Version 20); IDE:DevEco Studio 6.0.0.858; ROM:6.0.0.107; +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; ### 权限要求 diff --git a/zh-cn/react-native-ssl-pinning.md b/zh-cn/react-native-ssl-pinning.md index 1f761312..10e9c682 100644 --- a/zh-cn/react-native-ssl-pinning.md +++ b/zh-cn/react-native-ssl-pinning.md @@ -20,7 +20,7 @@ | 三方库版本 | 发布信息 | 支持RN版本 | |--------| ------------------------------------------------------------ | ---------- | -| 1.5.7@deprecated | [@react-native-oh-tpl/react-native-ssl-pinning Releases(deprecated)](https://github.com/react-native-oh-library/react-native-ssl-pinning/releases) | 0.72 | +| <= 1.5.7-0.0.2@deprecated | [@react-native-oh-tpl/react-native-ssl-pinning Releases(deprecated)](https://github.com/react-native-oh-library/react-native-ssl-pinning/releases) | 0.72 | | 1.5.8 | [@react-native-ohos/react-native-ssl-pinning Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-ssl-pinning/releases) | 0.72 | | 1.6.0 | [@react-native-ohos/react-native-ssl-pinning Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-ssl-pinning/releases) | 0.77 | @@ -307,7 +307,68 @@ cd entry ohpm install --no-link ``` -### 3.在 ArkTs 侧引入 SslPinningPackage +### 3.配置 CMakeLists 和引入 SslPinningPackage + +> 若使用的是 <= 1.5.7-0.0.2 版本,请跳过本章。 + +打开 `entry/src/main/cpp/CMakeLists.txt`,添加: + +```diff +project(rnapp) +cmake_minimum_required(VERSION 3.4.1) +set(CMAKE_SKIP_BUILD_RPATH TRUE) +set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}") +set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules") ++ set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules") +set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp") +set(LOG_VERBOSITY_LEVEL 1) +set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments") +set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie") +set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use +add_compile_definitions(WITH_HITRACE_SYSTRACE) + +add_subdirectory("${RNOH_CPP_DIR}" ./rn) + +# RNOH_BEGIN: manual_package_linking_1 +add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) ++ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-ssl-pinning/src/main/cpp" ./ssl_pinning) + +# RNOH_END: manual_package_linking_1 + +file(GLOB GENERATED_CPP_FILES "./generated/*.cpp") + +add_library(rnoh_app SHARED + ${GENERATED_CPP_FILES} + "./PackageProvider.cpp" + "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp" +) +target_link_libraries(rnoh_app PUBLIC rnoh) + +# RNOH_BEGIN: manual_package_linking_2 +target_link_libraries(rnoh_app PUBLIC rnoh_sample_package) ++ target_link_libraries(rnoh_app PUBLIC rnoh_ssl_pinning) +# RNOH_END: manual_package_linking_2 +``` +打开 `entry/src/main/cpp/PackageProvider.cpp`,添加: + +```diff +#include "RNOH/PackageProvider.h" +#include "generated/RNOHGeneratedPackage.h" +#include "SamplePackage.h" ++ #include "SslPinningPackage.h" + +using namespace rnoh; + +std::vector> PackageProvider::getPackages(Package::Context ctx) { + return { + std::make_shared(ctx), + std::make_shared(ctx), ++ std::make_shared(ctx) + }; +} +``` + +### 4.在 ArkTs 侧引入 SslPinningPackage 打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: @@ -323,7 +384,7 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { } ``` -### 4.运行 +### 5.运行 点击右上角的 `sync` 按钮 @@ -339,15 +400,14 @@ ohpm install ## 约束与限制 ### 兼容性 -要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机ROM。 -请到三方库的 Releases 发布地址查看配套的版本信息: +要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -| 三方库版本 | 发布信息 | 支持RN版本 | -|--------| ------------------------------------------------------------ | ---------- | -| 1.5.7@deprecated | [@react-native-oh-tpl/react-native-ssl-pinning Releases(deprecated)](https://github.com/react-native-oh-library/react-native-ssl-pinning/releases) | 0.72 | -| 1.5.8 | [@react-native-ohos/react-native-ssl-pinning Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-ssl-pinning/releases) | 0.72 | -| 1.6.0 | [@react-native-ohos/react-native-ssl-pinning Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-ssl-pinning/releases) | 0.77 | +在以下版本验证通过: + +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; ### 权限要求 -- Gitee