diff --git a/en/mixpanel-react-native.md b/en/mixpanel-react-native.md index 6119ef37693ff2f6b3f628bf6146d86e9471899e..9aa4c1a5960130edf8b4148062fd68da078b42b7 100644 --- a/en/mixpanel-react-native.md +++ b/en/mixpanel-react-native.md @@ -16,12 +16,16 @@ ## Installation and Usage -Find the matching version information in the release address of a third-party library:[@react-native-oh-tpl/mixpanel-react-native Releases](https://github.com/react-native-oh-library/mixpanel-react-native/releases).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. +Find the matching version information in the release address of a third-party library: -| Version | Post Information | Support RN Version | -| ---------- | ------------------------------------------------------------ | ---------- | -| 3.0.5 | [@react-native-oh-tpl/mixpanel-react-native Releases](https://github.com/react-native-oh-library/mixpanel-react-native/releases) | 0.72 | -| 3.1.3 | [@react-native-ohos/mixpanel-react-native Releases]() | 0.77 | +| Third-party Library Version | Release Information | Supported RN Version | +|----------------------------|--------------------------------------------------------------------------------------------------------------------------------------| ---------- | +| <= 3.0.5-0.1.1| [@react-native-oh-tpl/mixpanel-react-native Releases(deprecated)](https://github.com/react-native-oh-library/mixpanel-react-native/releases) | 0.72 | +| 3.0.6 | [@react-native-ohos/mixpanel-react-native Releases](https://github.com/react-native-oh-library/mixpanel-react-native/releases) | 0.72 | +| 3.2.0 | [@react-native-ohos/mixpanel-react-native Releases](https://github.com/react-native-oh-library/mixpanel-react-native/releases) | 0.77 | + + +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: @@ -30,10 +34,6 @@ Go to the project directory and execute the following instruction: #### **npm** ```bash -# 0.72 -npm install @react-native-oh-tpl/mixpanel-react-native - -# 0.77 npm install @react-native-ohos/mixpanel-react-native ``` @@ -41,10 +41,6 @@ npm install @react-native-ohos/mixpanel-react-native #### **yarn** ```bash -# 0.72 -yarn add @react-native-oh-tpl/mixpanel-react-native - -# 0.77 yarn add @react-native-ohos/mixpanel-react-native ``` @@ -79,11 +75,15 @@ export default function MixpanelDemo() { ## Use Codegen +Version >= @react-native-ohos/mixpanel-react-native@3.0.6, compatible with codegen-lib for generating 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 -Currently, HarmonyOS does not support AutoLink. Therefore, you need to manually configure the linking. +Version >= @react-native-ohos/mixpanel-react-native@3.0.6, 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 + +This step provides guidance for manually configuring native dependencies. Open the `harmony` directory of the HarmonyOS project in DevEco Studio. @@ -108,15 +108,6 @@ Method 1 (recommended): Use the HAR file. Open `entry/oh-package.json5` file and add the following dependencies: -+ 0.72 -```json -"dependencies": { -"@rnoh/react-native-openharmony": "file:../react_native_openharmony", -"@react-native-oh-tpl/mixpanel-react-native": "file:../../node_modules/@react-native-oh-tpl/mixpanel-react-native/harmony/mixpanel.har" -} -``` - -+ 0.77 ```json "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", @@ -139,7 +130,9 @@ Method 2: Directly link to the source code. ### 3.Configuring CMakeLists and Introducing UnistylesPackage -> V3.1.3 Need Configuring CMakeLists and Introducing UnistylesPackage。 +> If you are using version <= 3.0.5-0.1.1, please skip this chapter. + +Open `entry/src/main/cpp/CMakeLists.txt` and add the following code: ```diff ... @@ -190,10 +183,6 @@ Open `entry/src/main/ets/RNPackagesFactory.ts`,add: ```diff ... -// 0.72 -+ import { MixpanelPackage } from '@react-native-oh-tpl/mixpanel-react-native/ts'; - -// 0.77 + import { MixpanelPackage } from '@react-native-ohos/mixpanel-react-native/ts'; export function createRNPackages(ctx: RNPackageContext): RNPackage[] { return [ @@ -220,10 +209,13 @@ Then build and run the code. ### Compatibility -The content of this document has been validated based on 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. + +Verified in the following versions. -1. RNOH:0.72.33; 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; ## API diff --git a/en/react-native-callkeep.md b/en/react-native-callkeep.md index d5428c801ed1c43ba22c5d434594402d7fcddfd8..a96274110b8a23d7c52db1bb39fe51d26aaa8685 100644 --- a/en/react-native-callkeep.md +++ b/en/react-native-callkeep.md @@ -1,4 +1,4 @@ -模板版本:v0.2.2 +> Template version: v0.2.2

react-native-callkeep

@@ -18,33 +18,37 @@ > [!TIP] [Github 地址](https://github.com/react-native-oh-library/react-native-callkeep) -## 安装与使用 +## Installation and Usage -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-callkeep Releases](https://github.com/react-native-oh-library/react-native-callkeep/releases)。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 - -进入到工程目录并输入以下命令: +Find the matching version information in the release address of a third-party library: +| Third-party Library Version | Release Information | Supported RN Version | +|----------------------------|--------------------------------------------------------------------------------------------------------------------------------------| ---------- | +| <= 4.3.14-0.0.1 | [@react-native-oh-tpl/react-native-callkeep Releases(deprecated)](https://github.com/react-native-oh-library/react-native-callkeep/releases) | 0.72 | +| 4.3.15 | [@react-native-ohos/react-native-callkeep Releases](https://github.com/react-native-oh-library/react-native-callkeep/releases) | 0.72 | +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: #### **npm** ```bash -npm install @react-native-oh-tpl/react-native-callkeep +npm install @react-native-ohos/react-native-callkeep ``` #### **yarn** ```bash -yarn add @react-native-oh-tpl/react-native-callkeep +yarn add @react-native-ohos/react-native-callkeep ``` -下面的代码展示了这个库的基本使用场景: +The following code shows the basic use scenario of the repository: -> [!WARNING] 使用时 import 的库名不变。 +> [!WARNING] The name of the imported repository remains unchanged. ```js import React, { useState, useEffect } from 'react'; @@ -93,17 +97,21 @@ export function CallKeepExample() { } ``` -## 使用 Codegen +## Use Codegen + +Version >= @react-native-ohos/react-native-callkeep@4.3.15, compatible with codegen-lib for generating bridge code. -本库已经适配了 `Codegen` ,在使用前需要主动执行生成三方库桥接代码,详细请参考[ Codegen 使用文档](/zh-cn/codegen.md)。 +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 -目前鸿蒙暂不支持 AutoLink,所以 Link 步骤需要手动配置。 +Version >= @react-native-ohos/react-native-callkeep@4.3.15, 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 + +This step provides guidance for manually configuring native dependencies. -首先需要使用 DevEco Studio 打开项目里的鸿蒙工程 `harmony` +Open the `harmony` directory of the HarmonyOS project in DevEco Studio. -### 在工程根目录的 `oh-package.json5` 添加 overrides字段 +### 1. Adding the overrides Field to oh-package.json5 File in the Root Directory of the Project ```json { @@ -114,46 +122,92 @@ export function CallKeepExample() { } ``` -### 2.引入原生端代码 +### 2.Introducing Native Code -目前有两种方法: +Currently, two methods are available: -1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法); -2. 直接链接源码。 +Method 1 (recommended): Use the HAR file. -方法一:通过 har 包引入(推荐) +> [!TIP] The HAR file is stored in the `harmony` directory in the installation path of the third-party library. -> [!TIP] har 包位于三方库安装路径的 `harmony` 文件夹下。 +Open `entry/oh-package.json5` file and add the following dependencies: -打开 `entry/oh-package.json5`,添加以下依赖 ```json "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", - "@react-native-oh-tpl/react-native-callkeep": "file:../../node_modules/@react-native-oh-tpl/react-native-callkeep/harmony/call_keep.har" + "@react-native-ohos/react-native-callkeep": "file:../../node_modules/@react-native-ohos/react-native-callkeep/harmony/call_keep.har" } ``` -点击右上角的 `sync` 按钮 +Click the `sync` button in the upper right corner. -或者在终端执行: +Alternatively, run the following instruction on the terminal: ```bash cd entry ohpm install ``` -方法二:直接链接源码 +Method 2: Directly link to the source code. -> [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](/zh-cn/link-source-code.md) +> [!TIP] For details, see [Directly Linking Source Code](/en/link-source-code.md). +### 3.Configuring CMakeLists and Introducing RNCallKeepPackage -### 3.在 ArkTs 侧引入 RNCallKeepPackage +> If you are using version <= 4.3.14-0.0.1, please skip this chapter. -打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: +Open `entry/src/main/cpp/CMakeLists.txt` and add the following code: + +```diff +... +project(rnapp) +cmake_minimum_required(VERSION 3.4.1) +set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}") ++ set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules") +set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp") + +add_subdirectory("${RNOH_CPP_DIR}" ./rn) + +# RNOH_END: manual_package_linking_1 +add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) ++ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-callkeep/src/main/cpp" ./callkeep) +# RNOH_END: manual_package_linking_1 + +add_library(rnoh_app SHARED + "./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_callkeep) +# RNOH_BEGIN: manual_package_linking_2 +``` + +Open `entry/src/main/cpp/PackageProvider.cpp` and add the following code: + +```diff +#include "RNOH/PackageProvider.h" ++ #include "RNCallKeepPackage.h" + +using namespace rnoh; + +std::vector> PackageProvider::getPackages(Package::Context ctx) { + return { ++ std::make_shared(ctx) +} +``` + + +### 4.Introducing RNCallKeepPackage to ArkTS + +Open `entry/src/main/ets/RNPackagesFactory.ts`,add: ```diff ... -+ import { RNCallKeepPackage } from '@react-native-oh-tpl/react-native-callkeep'; ++ import { RNCallKeepPackage } from '@react-native-ohos/react-native-callkeep'; export function createRNPackages(ctx: RNPackageContext): RNPackage[] { return [ @@ -163,27 +217,31 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { } ``` -### 4.运行 +### 5.Running -点击右上角的 `sync` 按钮 +Click the `sync` button in the upper right corner. -或者在终端执行: +Alternatively, run the following instruction on the terminal: ```bash cd entry ohpm install ``` -然后编译、运行即可。 +Then build and run the code. + +## Constraints -## 约束与限制 +### Compatibility -### 兼容性 -要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 +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. -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/react-native-callkeep Releases](https://github.com/react-native-oh-library/react-native-callkeep/releases) +Verified in the following versions. +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/en/react-native-picker-picker.md b/en/react-native-picker-picker.md index 2eccbf350ee733d068225075430fb46fdb6e4c29..c84323a34dde3d2f34f8ae0e9baad6626588e198 100644 --- a/en/react-native-picker-picker.md +++ b/en/react-native-picker-picker.md @@ -16,37 +16,29 @@ ## Installation and Usage -Find the matching version information in the release address of a third-party library: [@react-native-oh-tpl/picker Releases](https://github.com/react-native-oh-library/picker/releases).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. +Find the matching version information in the release address of a third-party library: -Go to the project directory and execute the following instruction: -| Library Version | Release Info | Supported RN Version | -| :--- | :--- | :--- | -| 2.6.1 | [@react-native-oh-tpl/picker Releases](https://github.com/react-native-oh-library/picker/releases) | 0.72 | -| 2.11.1 | [@react-native-ohos/picker Releases]() | 0.77 | +| Third-party Library Version | Release Information | Supported RN Version | +|---------------------------| ------------------------------------------------------------ |---------------------------------------------------------------------------------------------------------------------------| +| <= 2.6.3 | [@react-native-oh-tpl/picker Releases(deprecated)](https://github.com/react-native-oh-library/picker/releases) | 0.72 | +| 2.6.4 | [@react-native-ohos/picker Releases](https://gitcode.com/openharmony-sig/rntpc_picker/releases) | 0.72 | +| 2.11.2 | [@react-native-ohos/picker Releases](https://gitcode.com/openharmony-sig/rntpc_picker/releases) | 0.77 | -For older versions not published to npm, please refer to the [Installation Guide](/zh-cn/tgz-usage.md) to install the tgz package. +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. -Navigate to your project directory and enter the following commands: +Go to the project directory and execute the following instruction: #### **npm** ```bash -# 0.72 -npm install @react-native-oh-tpl/picker - -# 0.77 npm install @react-native-ohos/picker ``` #### **yarn** ```bash -# 0.72 -yarn add @react-native-oh-tpl/picker - -# 0.77 yarn add @react-native-ohos/picker ``` @@ -79,11 +71,15 @@ export const PickerExample = ()=>{ ## Use Codegen +Version >= @react-native-ohos/picker@2.6.4, compatible with codegen-lib for generating 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 -Currently, HarmonyOS does not support AutoLink. Therefore, you need to manually configure the linking. +Version >= @react-native-ohos/picker@2.6.4, 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 + +This step provides guidance for manually configuring native dependencies. Open the `harmony` directory of the HarmonyOS project in DevEco Studio. @@ -108,18 +104,6 @@ Method 1 (recommended): Use the HAR file. Open `entry/oh-package.json5` file and add the following dependencies: -- 0.72 - -```json -"dependencies": { - "@rnoh/react-native-openharmony": "file:../react_native_openharmony", - - "@react-native-oh-tpl/picker": "file:../../node_modules/@react-native-oh-tpl/picker/harmony/picker.har", - } -``` - -- 0.77 - ```json "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", @@ -141,8 +125,7 @@ Method 2: Directly link to the source code. ### 3. Configuring CMakeLists and Introducing PickerPackge -> [!TIP] NC version and versions after 2.6.1-0.3.0 need to configure CMakeLists and introduce PickerPackge. Please skip this step if you don't have NC before v2.6.1-0.3.0. - +> If you are using version <= 2.6.3, please skip this chapter. Open the `entry/src/main/cpp/CMakeLists.txt`, add the following code: @@ -164,10 +147,6 @@ add_subdirectory("${RNOH_CPP_DIR}" ./rn) # RNOH_BEGIN: manual_package_linking_1 add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) -# 0.72 -+ add_subdirectory("${OH_MODULES}/@react-native-oh-tpl/picker/src/main/cpp" ./picker) - -# 0.77 + add_subdirectory("${OH_MODULES}/@react-native-ohos/picker/src/main/cpp" ./picker) # RNOH_END: manual_package_linking_1 @@ -214,10 +193,6 @@ Find `function buildCustomRNComponent()`, which is usually located in `entry/src ```diff ... -// 0.72 -+ import { RNCPicker, PICKER_TYPE } from "@react-native-oh-tpl/picker" - -// 0.77 + import { RNCPicker, PICKER_TYPE } from "@react-native-ohos/picker" @Builder @@ -253,10 +228,6 @@ Open the `entry/src/main/ets/RNPackagesFactory.ts` file and add the following co ```diff ... -// 0.72 -+ import { RNCPickerPackage } from '@react-native-oh-tpl/picker/ts'; - -// 0.77 + import { RNCPickerPackage } from '@react-native-ohos/picker/ts'; export function createRNPackages(ctx: RNPackageContext): RNPackage[] { @@ -284,9 +255,13 @@ Then build and run the code. ### Compatibility -This document is verified based on the following versions: -1. RNOH:0.72.86; SDK:HarmonyOS 6.0.0.47 (API Version 20); IDE:DevEco Studio 6.0.0.858; ROM:6.0.0.107; -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; +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.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; ## Properties diff --git a/en/react-native-text-input-mask.md b/en/react-native-text-input-mask.md index 61500c60f51f178bee40a4c795ae7a8518210842..0ef7739c5b5cd85da309677bb30dd66e78455cef 100644 --- a/en/react-native-text-input-mask.md +++ b/en/react-native-text-input-mask.md @@ -13,18 +13,18 @@

> [!TIP] [Github 地址](https://github.com/react-native-oh-library/react-native-text-input-mask) -> -> [!TIP] [Gitcode 地址](https://gitcode.com/openharmony-sig/rntpc_react-native-text-input-mask) -The repository of this third-party library has been migrated to Gitcode and supports direct download from npm. The new package name is: @react-native-ohos/react-native-text-input-mask. The specific version ownership relationship is as follows: +## Installation and Usage +Find the matching version information in the release address of a third-party library: -| Version | Package Name | Repository | Release | Support RN version | -| ---------- | ------------------------------------------------------------ | ---------- | ---------- | ---------- | -| 3.1.5 | @react-native-oh-tpl/react-native-text-input-mask | [Github](https://github.com/react-native-oh-library/react-native-text-input-mask)|[Github Releases](https://github.com/react-native-oh-library/react-native-text-input-mask/releases)|0.72 | -| 3.2.0 | @react-native-ohos/react-native-text-input-mask | [Gitcode](https://gitcode.com/openharmony-sig/rntpc_react-native-text-input-mask/tree/br_rnoh0.77) |[Gitcode Releases]() | 0.77 | +| Third-party Library Version | Release Information | Supported RN Version | +|-----------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------| ---------- | +| <= 3.1.5-0.0.7 | [@react-native-oh-tpl/react-native-text-input-mask Releases(deprecated)](https://github.com/react-native-oh-library/react-native-text-input-mask/releases) | 0.72 | +| 3.1.6 | [@react-native-ohos/react-native-text-input-mask Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-text-input-mask/releases) | 0.72 | +| 3.2.0 | [@react-native-ohos/react-native-text-input-mask Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-text-input-mask/releases) | 0.77 | -## 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: @@ -33,20 +33,12 @@ Go to the project directory and execute the following instruction: #### **npm** ```bash -# V3.1.5 for RN0.72 -npm install @react-native-oh-tpl/react-native-text-input-mask - -# V3.2.0 for RN0.77 npm install @react-native-ohos/react-native-text-input-mask ``` #### **yarn** ```bash -# V3.1.5 for RN0.72 -yarn add @react-native-oh-tpl/react-native-text-input-mask - -# V3.2.0 for RN0.77 yarn add @react-native-ohos/react-native-text-input-mask ``` @@ -161,7 +153,9 @@ const styles = StyleSheet.create({ ## Link -Currently, HarmonyOS does not support AutoLink. Therefore, you need to manually configure the linking. +Version >= @react-native-ohos/react-native-text-input-mask@3.1.6, 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 + +This step provides guidance for manually configuring native dependencies. Open the `harmony` directory of the HarmonyOS project in DevEco Studio. @@ -186,17 +180,6 @@ Method 1 (recommended): Use the HAR file. Open `entry/oh-package.json5` file and add the following dependencies: -- V3.1.5 for RN0.72 - -```json - "dependencies": { - "@rnoh/react-native-openharmony": "file:../react_native_openharmony", - "@react-native-oh-tpl/react-native-text-input-mask": "file:../../node_modules/@react-native-oh-tpl/react-native-text-input-mask/harmony/text_input_mask.har" - } -``` - -- V3.2.0 for RN0.77 - ```json "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", @@ -219,6 +202,8 @@ For details, see [Directly Linking Source Code](/en/link-source-code.md). ### 3. Configuring CMakeLists and Introducing RNTextInputMaskPackage +> If you are using version <= 3.1.5-0.0.7, please skip this chapter. + Open `entry/src/main/cpp/CMakeLists.txt` and add the following code: ```diff @@ -238,10 +223,6 @@ add_compile_definitions(WITH_HITRACE_SYSTRACE) set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use add_subdirectory("${RNOH_CPP_DIR}" ./rn) -# V3.1.5 for RN0.72 -+ add_subdirectory("${OH_MODULES}/@react-native-oh-tpl/react-native-text-input-mask/src/main/cpp" ./RNTextInputMask) - -# V3.2.0 for RN0.77 + add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-text-input-mask/src/main/cpp" ./RNTextInputMask) add_library(rnoh_app SHARED @@ -276,10 +257,6 @@ Open the `entry/src/main/ets/RNPackagesFactory.ts` file and add the following co ```diff ... -// V3.1.5 for RN0.72 -+ import { RNTextInputMaskPackage } from '@react-native-oh-tpl/react-native-text-input-mask/ts' - -// V3.2.0 for RN0.77 + import { RNTextInputMaskPackage } from '@react-native-ohos/react-native-text-input-mask/ts' export function createRNPackages(ctx: RNPackageContext): RNPackage[] { @@ -307,10 +284,14 @@ Then build and run the code. ### Compatibility -The content of this document has been 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.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; -1、RNOH: 0.72.28; SDK: HarmonyOS-5.0.0(API12); IDE: DevEco Studio 5.1.1.830; ROM: 6.0.0.112 SP12; -2、RNOH: 0.77.18; SDK: HarmonyOS-5.1.1.208(API19); IDE: DevEco Studio 5.1.1.830; ROM: 6.0.0.112 SP12 ## API diff --git a/zh-cn/mixpanel-react-native.md b/zh-cn/mixpanel-react-native.md index d485aaf7ed1cb06e661d346257b0b1ead885d36a..d6f52d0595db21e561e26821c19740d7240cb111 100644 --- a/zh-cn/mixpanel-react-native.md +++ b/zh-cn/mixpanel-react-native.md @@ -17,10 +17,12 @@ ## 安装与使用 请到三方库的 Releases 发布地址查看配套的版本信息: -| 三方库版本 | 发布信息 | 支持RN版本 | -| ---------- | ------------------------------------------------------------ | ---------- | -| 3.0.5 | [@react-native-oh-tpl/mixpanel-react-native Releases](https://github.com/react-native-oh-library/mixpanel-react-native/releases) | 0.72 | -| 3.1.3 | [@react-native-ohos/mixpanel-react-native Releases]() | 0.77 | + +| 三方库版本 | 发布信息 | 支持RN版本 | +|-----------------| ------------------------------------------------------------ | ---------- | +| <= 3.0.5-0.1.1 | [@react-native-oh-tpl/mixpanel-react-native Releases(deprecated)](https://github.com/react-native-oh-library/mixpanel-react-native/releases) | 0.72 | +| 3.0.6 | [@react-native-ohos/mixpanel-react-native Releases](https://github.com/react-native-oh-library/mixpanel-react-native/releases) | 0.72 | +| 3.2.0 | [@react-native-ohos/mixpanel-react-native Releases](https://github.com/react-native-oh-library/mixpanel-react-native/releases) | 0.77 | 对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 @@ -31,10 +33,6 @@ #### **npm** ```bash -# 0.72 -npm install @react-native-oh-tpl/mixpanel-react-native - -# 0.77 npm install @react-native-ohos/mixpanel-react-native ``` @@ -42,10 +40,6 @@ npm install @react-native-ohos/mixpanel-react-native #### **yarn** ```bash -# 0.72 -yarn add @react-native-oh-tpl/mixpanel-react-native - -# 0.77 yarn add @react-native-ohos/mixpanel-react-native ``` @@ -78,15 +72,18 @@ export default function MixpanelDemo() { } ``` + ## 使用 Codegen -> [!TIP] V3.1.3 不需要执行 Codegen。 +Version >= @react-native-ohos/mixpanel-react-native@3.0.6,已适配codegen-lib生成桥接代码。 本库已经适配了 `Codegen` ,在使用前需要主动执行生成三方库桥接代码,详细请参考[ Codegen 使用文档](/zh-cn/codegen.md)。 ## Link -目前 HarmonyOS 暂不支持 AutoLink,所以 Link 步骤需要手动配置。 +Version >= @react-native-ohos/mixpanel-react-native@3.0.6,已支持 Autolink,无需手动配置,目前只支持72框架。 Autolink框架指导文档:https://gitcode.com/openharmony-sig/ohos_react_native/blob/master/docs/zh-cn/Autolinking.md + +此步骤为手动配置原生依赖项的指导。 首先需要使用 DevEco Studio 打开项目里的 HarmonyOS 工程 `harmony` @@ -114,15 +111,6 @@ export default function MixpanelDemo() { 打开 `entry/oh-package.json5`,添加以下依赖 -+ 0.72 -```json -"dependencies": { -"@rnoh/react-native-openharmony": "file:../react_native_openharmony", -"@react-native-oh-tpl/mixpanel-react-native": "file:../../node_modules/@react-native-oh-tpl/mixpanel-react-native/harmony/mixpanel.har" -} -``` - -+ 0.77 ```json "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", @@ -145,7 +133,9 @@ ohpm install ### 3.配置 CMakeLists 和引入 MixpanelPackage -> V3.1.3 需要配置 CMakeLists 和引入 MixpanelPackage。 +> 若使用的是 <= 3.0.5-0.1.1 版本,请跳过本章。 + +打开 `entry/src/main/cpp/CMakeLists.txt`,添加: ```diff ... @@ -196,10 +186,6 @@ std::vector> PackageProvider::getPackages(Package::Cont ```diff ... -// 0.72 -+ import { MixpanelPackage } from '@react-native-oh-tpl/mixpanel-react-native/ts'; - -// 0.77 + import { MixpanelPackage } from '@react-native-ohos/mixpanel-react-native/ts'; export function createRNPackages(ctx: RNPackageContext): RNPackage[] { return [ @@ -226,10 +212,14 @@ ohpm install ### 兼容性 -本文档内容基于以下版本验证通过: +要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 + +在以下版本验证通过: + +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; -1. RNOH:0.72.33; 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; ## API diff --git a/zh-cn/react-native-callkeep.md b/zh-cn/react-native-callkeep.md index d5428c801ed1c43ba22c5d434594402d7fcddfd8..7f6e46f16d817cb1e289e2069ad13c88c40af847 100644 --- a/zh-cn/react-native-callkeep.md +++ b/zh-cn/react-native-callkeep.md @@ -20,10 +20,16 @@ ## 安装与使用 -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-callkeep Releases](https://github.com/react-native-oh-library/react-native-callkeep/releases)。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +请到三方库的 Releases 发布地址查看配套的版本信息: -进入到工程目录并输入以下命令: +| 三方库版本 | 发布信息 | 支持RN版本 | +|------------------| ------------------------------------------------------------ | ---------- | +| <= 4.3.14-0.0.1 | [@react-native-oh-tpl/react-native-callkeep Releases(deprecated)](https://github.com/react-native-oh-library/react-native-callkeep/releases) | 0.72 | +| 4.3.15 | [@react-native-ohos/react-native-callkeep Releases](https://github.com/react-native-oh-library/react-native-callkeep/releases) | 0.72 | + +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +进入到工程目录并输入以下命令: @@ -31,13 +37,13 @@ #### **npm** ```bash -npm install @react-native-oh-tpl/react-native-callkeep +npm install @react-native-ohos/react-native-callkeep ``` #### **yarn** ```bash -yarn add @react-native-oh-tpl/react-native-callkeep +yarn add @react-native-ohos/react-native-callkeep ``` @@ -95,13 +101,17 @@ export function CallKeepExample() { ``` ## 使用 Codegen +Version >= @react-native-ohos/react-native-callkeep@4.3.15,已适配codegen-lib生成桥接代码。 + 本库已经适配了 `Codegen` ,在使用前需要主动执行生成三方库桥接代码,详细请参考[ Codegen 使用文档](/zh-cn/codegen.md)。 ## Link -目前鸿蒙暂不支持 AutoLink,所以 Link 步骤需要手动配置。 +Version >= @react-native-ohos/react-native-callkeep@4.3.15,已支持 Autolink,无需手动配置,目前只支持72框架。 Autolink框架指导文档:https://gitcode.com/openharmony-sig/ohos_react_native/blob/master/docs/zh-cn/Autolinking.md -首先需要使用 DevEco Studio 打开项目里的鸿蒙工程 `harmony` +此步骤为手动配置原生依赖项的指导。 + +首先需要使用 DevEco Studio 打开项目里的 HarmonyOS 工程 `harmony` ### 在工程根目录的 `oh-package.json5` 添加 overrides字段 @@ -130,7 +140,7 @@ export function CallKeepExample() { ```json "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", - "@react-native-oh-tpl/react-native-callkeep": "file:../../node_modules/@react-native-oh-tpl/react-native-callkeep/harmony/call_keep.har" + "@react-native-ohos/react-native-callkeep": "file:../../node_modules/@react-native-ohos/react-native-callkeep/harmony/call_keep.har" } ``` @@ -146,14 +156,63 @@ ohpm install > [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](/zh-cn/link-source-code.md) +### 3.配置 CMakeLists 和引入 RNCallKeepPackage + +> 若使用的是 <= 4.3.14-0.0.1 版本,请跳过本章。 + +打开 `entry/src/main/cpp/CMakeLists.txt`,添加: + +```diff +... + +project(rnapp) +cmake_minimum_required(VERSION 3.4.1) +set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}") ++ set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules") +set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp") + +add_subdirectory("${RNOH_CPP_DIR}" ./rn) + +# RNOH_END: manual_package_linking_1 +add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) ++ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-callkeep/src/main/cpp" ./callkeep) +# RNOH_END: manual_package_linking_1 + +add_library(rnoh_app SHARED + "./PackageProvider.cpp" + "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp" +) -### 3.在 ArkTs 侧引入 RNCallKeepPackage +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_callkeep) +# RNOH_BEGIN: manual_package_linking_2 +``` + +打开 `entry/src/main/cpp/PackageProvider.cpp`,添加: + +```diff +#include "RNOH/PackageProvider.h" ++ #include "RNCallKeepPackage.h" + +using namespace rnoh; + +std::vector> PackageProvider::getPackages(Package::Context ctx) { + return { ++ std::make_shared(ctx) +} +``` + + +### 4.在 ArkTs 侧引入 RNCallKeepPackage 打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: ```diff ... -+ import { RNCallKeepPackage } from '@react-native-oh-tpl/react-native-callkeep'; ++ import { RNCallKeepPackage } from '@react-native-ohos/react-native-callkeep'; export function createRNPackages(ctx: RNPackageContext): RNPackage[] { return [ @@ -163,7 +222,7 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { } ``` -### 4.运行 +### 5.运行 点击右上角的 `sync` 按钮 @@ -182,9 +241,11 @@ ohpm install 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/react-native-callkeep Releases](https://github.com/react-native-oh-library/react-native-callkeep/releases) - +在以下版本验证通过: +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-picker-picker.md b/zh-cn/react-native-picker-picker.md index 7ab5b0cda5b011cbaca91a08ac69fe8155534dd6..de7ab37a2a8eb66b71eacb64b64ac80ccf3d244c 100644 --- a/zh-cn/react-native-picker-picker.md +++ b/zh-cn/react-native-picker-picker.md @@ -18,10 +18,11 @@ 请到三方库的 Releases 发布地址查看配套的版本信息: -| 三方库版本 | 发布信息 | 支持RN版本 | -| ---------- | ------------------------------------------------------------ | ---------- | -| 2.6.1 | [@react-native-oh-tpl/picker Releases](https://github.com/react-native-oh-library/picker/releases) | 0.72 | -| 2.11.1 | [@react-native-ohos/picker Releases]() | 0.77 | +| 三方库版本 | 发布信息 | 支持RN版本 | +|---------------------------| ------------------------------------------------------------ |---------------------------------------------------------------------------------------------------------------------------| +| <= 2.6.3 | [@react-native-oh-tpl/picker Releases(deprecated)](https://github.com/react-native-oh-library/picker/releases) | 0.72 | +| 2.6.4 | [@react-native-ohos/picker Releases](https://gitcode.com/openharmony-sig/rntpc_picker/releases) | 0.72 | +| 2.11.2 | [@react-native-ohos/picker Releases](https://gitcode.com/openharmony-sig/rntpc_picker/releases) | 0.77 | 对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 @@ -32,20 +33,12 @@ #### **npm** ```bash -# 0.72 -npm install @react-native-oh-tpl/picker - -# 0.77 npm install @react-native-ohos/picker ``` #### **yarn** ```bash -# 0.72 -yarn add @react-native-oh-tpl/picker - -# 0.77 yarn add @react-native-ohos/picker ``` @@ -79,13 +72,15 @@ export const PickerExample = ()=>{ ## 使用 Codegen -> [!TIP] V2.11.1 不需要执行 Codegen。 +Version >= @react-native-ohos/picker@2.6.4,已适配codegen-lib生成桥接代码。 -本库已经适配了 Codegen ,在使用前需要主动执行生成三方库桥接代码,详细请参考 [Codegen 使用文档。](/zh-cn/codegen.md) +本库已经适配了 `Codegen` ,在使用前需要主动执行生成三方库桥接代码,详细请参考[ Codegen 使用文档](/zh-cn/codegen.md)。 ## Link -目前 HarmonyOS 暂不支持 AutoLink,所以 Link 步骤需要手动配置。 +Version >= @react-native-ohos/picker@2.6.4,已支持 Autolink,无需手动配置,目前只支持72框架。 Autolink框架指导文档:https://gitcode.com/openharmony-sig/ohos_react_native/blob/master/docs/zh-cn/Autolinking.md + +此步骤为手动配置原生依赖项的指导。 首先需要使用 DevEco Studio 打开项目里的 HarmonyOS 工程 `harmony` @@ -113,18 +108,6 @@ export const PickerExample = ()=>{ 打开 `entry/oh-package.json5`,添加以下依赖 -- 0.72 - -```json -"dependencies": { - "@rnoh/react-native-openharmony": "file:../react_native_openharmony", - - "@react-native-oh-tpl/picker": "file:../../node_modules/@react-native-oh-tpl/picker/harmony/picker.har", - } -``` - -- 0.77 - ```json "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", @@ -148,7 +131,7 @@ ohpm install ### 3.配置 CMakeLists 和引入 PickerPackge -> [!TIP] nc版本以及2.6.1-0.3.0以后的版本需要配置 CMakeLists 和引入 PickerPackge,v2.6.1-0.3.0以前不带nc的版本请跳过此步骤 +> 若使用的是 <= 2.6.3 版本,请跳过本章。 打开 `entry/src/main/cpp/CMakeLists.txt`,添加: @@ -170,10 +153,6 @@ add_subdirectory("${RNOH_CPP_DIR}" ./rn) # RNOH_BEGIN: manual_package_linking_1 add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) -# 0.72 -+ add_subdirectory("${OH_MODULES}/@react-native-oh-tpl/picker/src/main/cpp" ./picker) - -# 0.77 + add_subdirectory("${OH_MODULES}/@react-native-ohos/picker/src/main/cpp" ./picker) # RNOH_END: manual_package_linking_1 @@ -219,10 +198,6 @@ std::vector> PackageProvider::getPackages(Package::Cont ```diff ... -// 0.72 -+ import { RNCPicker, PICKER_TYPE } from "@react-native-oh-tpl/picker" - -// 0.77 + import { RNCPicker, PICKER_TYPE } from "@react-native-ohos/picker" @Builder @@ -258,10 +233,6 @@ const arkTsComponentNames: Array = [ ```diff ... -// 0.72 -+ import { RNCPickerPackage } from '@react-native-oh-tpl/picker/ts'; - -// 0.77 + import { RNCPickerPackage } from '@react-native-ohos/picker/ts'; export function createRNPackages(ctx: RNPackageContext): RNPackage[] { @@ -289,9 +260,13 @@ ohpm install ### 兼容性 -本文档内容基于以下版本验证通过: -1. RNOH:0.72.86; SDK:HarmonyOS 6.0.0.47 (API Version 20); IDE:DevEco Studio 6.0.0.858; ROM:6.0.0.107; -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; +要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 + +在以下版本验证通过: + +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-text-input-mask.md b/zh-cn/react-native-text-input-mask.md index cef025c8789f224f8e5bf10692ae1eb29bb23cc9..f4be859bb9ee32f531cab511c6b96425b873f804 100644 --- a/zh-cn/react-native-text-input-mask.md +++ b/zh-cn/react-native-text-input-mask.md @@ -13,20 +13,19 @@

- > [!TIP] [Github 地址](https://github.com/react-native-oh-library/react-native-text-input-mask) -> -> [!TIP] [Gitcode 地址](https://gitcode.com/openharmony-sig/rntpc_react-native-text-input-mask) -该第三方库的仓库已迁移至 Gitcode,且支持直接从 npm 下载,新的包名为:@react-native-ohos/react-native-text-input-mask,具体版本所属关系如下: +## 安装与使用 +请到三方库的 Releases 发布地址查看配套的版本信息: -| 三方库版本 | 包名 | 仓库地址 | 发布(Release) | 支持RN版本 | -| ---------- | ------------------------------------------------------------ | ---------- | ---------- | ---------- | -| 3.1.5 | @react-native-oh-tpl/react-native-text-input-mask | [Github](https://github.com/react-native-oh-library/react-native-text-input-mask)|[Github Releases](https://github.com/react-native-oh-library/react-native-text-input-mask/releases)|0.72 | -| 3.2.0 | @react-native-ohos/react-native-text-input-mask | [Gitcode](https://gitcode.com/openharmony-sig/rntpc_react-native-text-input-mask/tree/br_rnoh0.77) |[Gitcode Releases]() | 0.77 | +| 三方库版本 | 发布信息 | 支持RN版本 | +|---------------------------| ------------------------------------------------------------ | ---------- | +| <= 3.1.5-0.0.7 | [@react-native-oh-tpl/react-native-text-input-mask Releases(deprecated)](https://github.com/react-native-oh-library/react-native-text-input-mask/releases) | 0.72 | +| 3.1.6 | [@react-native-ohos/react-native-text-input-mask Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-text-input-mask/releases) | 0.72 | +| 3.2.0 | [@react-native-ohos/react-native-text-input-mask Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-text-input-mask/releases) | 0.77 | -## 安装与使用 +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 进入到工程目录并输入以下命令: @@ -35,20 +34,12 @@ #### **npm** ```bash -# V3.1.5 for RN0.72 -npm install @react-native-oh-tpl/react-native-text-input-mask - -# V3.2.0 for RN0.77 npm install @react-native-ohos/react-native-text-input-mask ``` #### **yarn** ```bash -# V3.1.5 for RN0.72 -yarn add @react-native-oh-tpl/react-native-text-input-mask - -# V3.2.0 for RN0.77 yarn add @react-native-ohos/react-native-text-input-mask ``` @@ -156,9 +147,12 @@ const styles = StyleSheet.create({ ## Link -目前 HarmonyOS 暂不支持 AutoLink,所以 Link 步骤需要手动配置。 -首先需要使用 DevEco Studio 打开项目里的 HarmonyOS 工程 `harmony` +Version >= @react-native-ohos/react-native-text-input-mask@3.1.6,已支持 Autolink,无需手动配置,目前只支持72框架。 Autolink框架指导文档:https://gitcode.com/openharmony-sig/ohos_react_native/blob/master/docs/zh-cn/Autolinking.md + +此步骤为手动配置原生依赖项的指导。 + +首先需要使用 DevEco Studio 打开项目里的HarmonyOS工程 `harmony` ### 1.在工程根目录的 `oh-package.json` 添加 overrides 字段 @@ -184,17 +178,6 @@ const styles = StyleSheet.create({ 打开 `entry/oh-package.json5`,添加以下依赖 -- V3.1.5 for RN0.72 - -```json - "dependencies": { - "@rnoh/react-native-openharmony": "file:../react_native_openharmony", - "@react-native-oh-tpl/react-native-text-input-mask": "file:../../node_modules/@react-native-oh-tpl/react-native-text-input-mask/harmony/text_input_mask.har" - } -``` - -- V3.2.0 for RN0.77 - ```json "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", @@ -217,6 +200,8 @@ ohpm install ### 3.配置 CMakeLists 和引入 RNTextInputMaskPackage +> 若使用的是 <= 3.1.5-0.0.7 版本,请跳过本章。 + 打开 `entry/src/main/cpp/CMakeLists.txt`,添加: ``` diff @@ -237,10 +222,6 @@ set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use add_subdirectory("${RNOH_CPP_DIR}" ./rn) -# V3.1.5 for RN0.72 -+ add_subdirectory("${OH_MODULES}/@react-native-oh-tpl/react-native-text-input-mask/src/main/cpp" ./RNTextInputMask) - -# V3.2.0 for RN0.77 + add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-text-input-mask/src/main/cpp" ./RNTextInputMask) add_library(rnoh_app SHARED @@ -275,10 +256,6 @@ target_link_libraries(rnoh_app PUBLIC rnoh) ```diff ... -// V3.1.5 for RN0.72 -+ import { RNTextInputMaskPackage } from '@react-native-oh-tpl/react-native-text-input-mask/ts' - -// V3.2.0 for RN0.77 + import { RNTextInputMaskPackage } from '@react-native-ohos/react-native-text-input-mask/ts' export function createRNPackages(ctx: RNPackageContext): RNPackage[] { @@ -306,10 +283,13 @@ ohpm install ### 兼容性 -本文档内容基于以下版本验证通过: +要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 + +在以下版本验证通过: -1、RNOH: 0.72.28; SDK: HarmonyOS-5.0.0(API12); IDE: DevEco Studio 5.1.1.830; ROM: 6.0.0.112 SP12; -2、RNOH: 0.77.18; SDK: HarmonyOS-5.1.1.208(API19); IDE: DevEco Studio 5.1.1.830; ROM: 6.0.0.112 SP12 +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