From ed2fd9828b0ed488f91e486240a3d316241da729 Mon Sep 17 00:00:00 2001 From: liang_tao001 Date: Mon, 26 Jan 2026 09:44:39 +0800 Subject: [PATCH 1/2] =?UTF-8?q?docs:=20=E4=BF=AE=E6=94=B9react-native-orie?= =?UTF-8?q?ntation-locker=E5=BA=93=E7=9A=84=E4=BD=BF=E7=94=A8=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liang_tao001 --- en/react-native-orientation-locker.md | 6 +++--- zh-cn/react-native-orientation-locker.md | 8 ++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/en/react-native-orientation-locker.md b/en/react-native-orientation-locker.md index 283a378a..f9eddd90 100644 --- a/en/react-native-orientation-locker.md +++ b/en/react-native-orientation-locker.md @@ -9,9 +9,9 @@ This project is based on [react-native-orientation-locker](https://github.com/wo 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-orientation-locker` The version correspondence details are as follows: | Name | Version | Release Information | Supported RN Version | Supported Autolink | Compile API Version | Community Baseline Version | npm Address | | ------------ | ------------ | ------------------------------ | ------------- | ------------- |------------------------ | ------------- | ------------- | -| @react-native-ohos/react-native-orientation-locker | 1.8.0 | [Gitcode Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-orientation-locker/releases) | 0.77 | 否 | API12+ | 1.7.0 | [Npm Address](https://www.npmjs.com/package/@react-native-ohos/react-native-orientation-locker) | -| @react-native-ohos/react-native-orientation-locker | 1.7.1 | [Gitcode Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-orientation-locker/releases) | 0.72 | 否 | API12+ | 1.7.0 | [Npm Address](https://www.npmjs.com/package/@react-native-ohos/react-native-orientation-locker) | -| @react-native-oh-tpl/react-native-orientation-locker | <= 1.7.0-0.0.7@deprecated | [Gitcode Releases](https://github.com/react-native-oh-library/react-native-orientation-locker/releases) | 0.72 | 否 | API12+ | 1.7.0 | [Npm Address](https://www.npmjs.com/package/@react-native-oh-tpl/react-native-orientation-locker) | +| @react-native-ohos/react-native-orientation-locker | 1.8.0 | [Gitcode Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-orientation-locker/releases) | 0.77 | No | API12+ | 1.7.0 | [Npm Address](https://www.npmjs.com/package/@react-native-ohos/react-native-orientation-locker) | +| @react-native-ohos/react-native-orientation-locker | 1.7.1 | [Gitcode Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-orientation-locker/releases) | 0.72 | Yes | API12+ | 1.7.0 | [Npm Address](https://www.npmjs.com/package/@react-native-ohos/react-native-orientation-locker) | +| @react-native-oh-tpl/react-native-orientation-locker | <= 1.7.0-0.0.7@deprecated | [Github Releases](https://github.com/react-native-oh-library/react-native-orientation-locker/releases) | 0.72 | No | API12+ | 1.7.0 | [Npm Address](https://www.npmjs.com/package/@react-native-oh-tpl/react-native-orientation-locker) | ## 1. Installation and Usage diff --git a/zh-cn/react-native-orientation-locker.md b/zh-cn/react-native-orientation-locker.md index 335d7954..0642cd26 100644 --- a/zh-cn/react-native-orientation-locker.md +++ b/zh-cn/react-native-orientation-locker.md @@ -10,8 +10,8 @@ | 三方库名称 | 三方库版本 | 发布信息 | 支持RN版本 | Autolink | 编译API版本 | 社区基线版本 | npm地址 | | ------------ | ------------ | ------------------------------ | ------------- | ------------- |------------------------ | ------------- | ------------- | | @react-native-ohos/react-native-orientation-locker | 1.8.0 | [Gitcode Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-orientation-locker/releases) | 0.77 | 否 | API12+ | 1.7.0 | [Npm Address](https://www.npmjs.com/package/@react-native-ohos/react-native-orientation-locker) | -| @react-native-ohos/react-native-orientation-locker | 1.7.1 | [Gitcode Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-orientation-locker/releases) | 0.72 | 否 | API12+ | 1.7.0 | [Npm Address](https://www.npmjs.com/package/@react-native-ohos/react-native-orientation-locker) | -| @react-native-oh-tpl/react-native-orientation-locker | <= 1.7.0-0.0.7@deprecated | [Gitcode Releases](https://github.com/react-native-oh-library/react-native-orientation-locker/releases) | 0.72 | 否 | API12+ | 1.7.0 | [Npm Address](https://www.npmjs.com/package/@react-native-oh-tpl/react-native-orientation-locker) | +| @react-native-ohos/react-native-orientation-locker | 1.7.1 | [Gitcode Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-orientation-locker/releases) | 0.72 | 是 | API12+ | 1.7.0 | [Npm Address](https://www.npmjs.com/package/@react-native-ohos/react-native-orientation-locker) | +| @react-native-oh-tpl/react-native-orientation-locker | <= 1.7.0-0.0.7@deprecated | [Github Releases](https://github.com/react-native-oh-library/react-native-orientation-locker/releases) | 0.72 | 否 | API12+ | 1.7.0 | [Npm Address](https://www.npmjs.com/package/@react-native-oh-tpl/react-native-orientation-locker) | ## 1. 安装与使用 @@ -222,10 +222,6 @@ const styles = StyleSheet.create({ 首先需要使用 DevEco Studio 打开项目里的 HarmonyOS 工程 `harmony`。 -此步骤为手动配置原生依赖项的指导。 - -首先需要使用 DevEco Studio 打开项目里的 HarmonyOS 工程 `harmony`。 - ### 2.1. Overrides RN SDK 为了让工程依赖同一个版本的 RN SDK,需要在工程根目录的 `oh-package.json5` 添加 overrides 字段,指向工程需要使用的 RN SDK 版本。替换的版本既可以是一个具体的版本号,也可以是一个模糊版本,还可以是本地存在的 HAR 包或源码目录。 -- Gitee From ae09840f954ef361a28ef2fa92e86e129f2ae40e Mon Sep 17 00:00:00 2001 From: liang_tao001 Date: Wed, 28 Jan 2026 16:46:51 +0800 Subject: [PATCH 2/2] =?UTF-8?q?docs:=20=E4=BF=AE=E6=94=B9react-native-devi?= =?UTF-8?q?ce-info=E5=BA=93=E7=9A=84=E4=BD=BF=E7=94=A8=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liang_tao001 --- en/react-native-device-info.md | 38 +++++++++++++++++++++++++++++++ zh-cn/react-native-device-info.md | 38 +++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/en/react-native-device-info.md b/en/react-native-device-info.md index a7765194..bb64ac1d 100644 --- a/en/react-native-device-info.md +++ b/en/react-native-device-info.md @@ -24,6 +24,7 @@ Please refer to the Releases page of the third-party library for the correspondi | <= 11.1.0-0.0.8@deprecated | [@react-native-oh-tpl/react-native-device-info Releases(deprecated)](https://github.com/react-native-oh-library/react-native-device-info/releases) | 0.72 | | 11.1.1 | [@react-native-ohos/react-native-device-info Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-device-info/releases) | 0.72 | | 14.0.5 | [@react-native-ohos/react-native-device-info Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-device-info/releases) | 0.77 | +| 14.1.2 | [@react-native-ohos/react-native-device-info Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-device-info/releases) | 0.82 | 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. @@ -194,6 +195,7 @@ This library has been adapted for `Codegen`. Before using it, you need to proact | | Is supported autolink | Supported RN Version | |--------------------------------------|-----------------------|----------------------| +| ~14.1.2 | No | 0.82 | | ~14.0.5 | No | 0.77 | | ~11.1.1 | Yes | 0.72 | | <= 11.1.0-0.0.8@deprecated | No | 0.72 | @@ -275,6 +277,8 @@ add_library(rnoh_app SHARED Open `entry/src/main/cpp/PackageProvider.cpp` and add the following code: +0.77 + ```diff #include "RNOH/PackageProvider.h" #include "generated/RNOHGeneratedPackage.h" @@ -291,10 +295,30 @@ std::vector> PackageProvider::getPackages(Package::Cont } ``` +0.72 + +```diff +#include "RNOH/PackageProvider.h" +#include "generated/RNOHGeneratedPackage.h" ++ #include "DeviceInfoPackage.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 RNDeviceInfoPackage to ArkTS Open the `entry/src/main/ets/RNPackagesFactory.ts` file and add the following code: +0.77 + ```diff ... + import {RNDeviceInfoPackage} from '@react-native-ohos/react-native-device-info/ts'; @@ -306,6 +330,20 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { ]; } ``` + +0.72 + +```diff + ... ++ import {DeviceInfoPackage} from '@react-native-ohos/react-native-device-info/ts'; + +export function createRNPackages(ctx: RNPackageContext): RNPackage[] { + return [ + new SamplePackage(ctx), ++ new DeviceInfoPackage(ctx) + ]; +} +``` ## Running diff --git a/zh-cn/react-native-device-info.md b/zh-cn/react-native-device-info.md index 7aacd081..6180b273 100644 --- a/zh-cn/react-native-device-info.md +++ b/zh-cn/react-native-device-info.md @@ -23,6 +23,7 @@ | <= 11.1.0-0.0.8@deprecated | [@react-native-oh-tpl/react-native-device-info Releases(deprecated)](https://github.com/react-native-oh-library/react-native-device-info/releases) | 0.72 | | 11.1.1 | [@react-native-ohos/react-native-device-info Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-device-info/releases) | 0.72 | | 14.0.5 | [@react-native-ohos/react-native-device-info Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-device-info/releases) | 0.77 | +| 14.1.2 | [@react-native-ohos/react-native-device-info Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-device-info/releases) | 0.82 | 对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 @@ -192,6 +193,7 @@ export default App; | | 是否支持autolink | RN框架版本 | |--------------------------------------|------------------|-----------| +| ~14.1.2 | No | 0.82 | | ~14.0.5 | No | 0.77 | | ~11.1.1 | Yes | 0.72 | | <= 11.1.0-0.0.8@deprecated | No | 0.72 | @@ -275,6 +277,8 @@ add_library(rnoh_app SHARED 打开 `entry/src/main/cpp/PackageProvider.cpp`,添加: +0.77 + ```diff #include "RNOH/PackageProvider.h" #include "generated/RNOHGeneratedPackage.h" @@ -291,10 +295,30 @@ std::vector> PackageProvider::getPackages(Package::Cont } ``` +0.72 + +```diff +#include "RNOH/PackageProvider.h" +#include "generated/RNOHGeneratedPackage.h" ++ #include "DeviceInfoPackage.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 侧引入 RNDeviceInfoPackage 打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: +0.77 + ```diff ... + import {RNDeviceInfoPackage} from '@react-native-ohos/react-native-device-info/ts'; @@ -306,6 +330,20 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { ]; } ``` + +0.72 + +```diff + ... ++ import {DeviceInfoPackage} from '@react-native-ohos/react-native-device-info/ts'; + +export function createRNPackages(ctx: RNPackageContext): RNPackage[] { + return [ + new SamplePackage(ctx), ++ new DeviceInfoPackage(ctx) + ]; +} +``` ## 运行 -- Gitee