diff --git a/zh-cn/react-native-community-push-notification-ios.md b/zh-cn/react-native-community-push-notification-ios.md index 60cd6858d6d0d79a070ac8c807247a9d2a40a8d5..6c721a25906f8953b0ad1699876dec2e9f74fc36 100644 --- a/zh-cn/react-native-community-push-notification-ios.md +++ b/zh-cn/react-native-community-push-notification-ios.md @@ -8,10 +8,13 @@ 该第三方库的仓库已迁移至 Gitee,且支持直接从 npm 下载,新的包名为:`@react-native-ohos/push-notification-ios`,具体版本所属关系如下: -| Version | Package Name | Repository | Release | -|----------------------------| ------------------------------------------------- | ------------------ | -------------------------- | -| <= 1.11.0-0.1.3@deprecated | @react-native-oh-tpl/push-notification-ios | [Github(deprecated)](https://github.com/react-native-oh-library/react-native-push-notification-ios) | [Github Releases(deprecated)](https://github.com/react-native-oh-library/react-native-push-notification-ios/releases) | -| > 1.11.0 | @react-native-ohos/push-notification-ios | [GitCode](https://gitcode.com/openharmony-sig/rntpc_ios) | [GitCode Releases](https://gitcode.com/openharmony-sig/rntpc_ios/releases) | +| Version | Package Name | Repository | Release | Version for RN | +| ------------------------- | ------------------------------------------------- | ------------------ | -------------------------- | ------------------------- | +| <= 1.11.0-0.1.3@deprecated | @react-native-oh-tpl/push-notification-ios | [Github(deprecated)](https://github.com/react-native-oh-library/react-native-push-notification-ios) | [Github Releases(deprecated)](https://github.com/react-native-oh-library/react-native-push-notification-ios/releases)| 0.72 | +| > 1.11.0 | @react-native-ohos/push-notification-ios | [GitCode](https://gitcode.com/openharmony-sig/rntpc_ios) | [GitCode Releases](https://gitcode.com/openharmony-sig/rntpc_ios/releases) | 0.72 | +| > 1.11.0 | @react-native-ohos/push-notification-ios | [GitCode](https://gitcode.com/openharmony-sig/rntpc_ios) | [GitCode Releases](https://gitcode.com/openharmony-sig/rntpc_ios/releases) | 0.77 | + + ## 1. 安装与使用 @@ -22,12 +25,20 @@ #### **npm** ```bash +#<= v1.11.0-0.1.3 +npm install @react-native-oh-tpl/push-notification-ios + +#> v1.11.0 npm install @react-native-ohos/push-notification-ios ``` #### **yarn** ```bash +#<= v1.11.0-0.1.3 +yarn add @react-native-oh-tpl/push-notification-ios + +#> v1.11.0 yarn add @react-native-ohos/push-notification-ios ``` @@ -195,7 +206,13 @@ export const App = () => { > [!TIP] har 包位于三方库安装路径的 `harmony` 文件夹下。 打开 `entry/oh-package.json5`,添加以下依赖 - +- <= V1.11.0-0.1.3 +```json +"dependencies": { + "@react-native-ohos/push-notification-ios": "file:../../node_modules/@react-native-oh-tpl/push-notification-ios/harmony/push_notification.har" + } +``` +- \> V1.11.0 ```json "dependencies": { "@react-native-ohos/push-notification-ios": "file:../../node_modules/@react-native-ohos/push-notification-ios/harmony/push_notification.har" @@ -223,6 +240,10 @@ ohpm install + set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules") # RNOH_BEGIN: manual_package_linking_1 +# <= V1.11.0-0.1.3 ++ add_subdirectory("${OH_MODULES}/@react-native-oh-tpl/push-notification-ios/src/main/cpp" ./push_notification) + +# > V1.11.0 + add_subdirectory("${OH_MODULES}/@react-native-ohos/push-notification-ios/src/main/cpp" ./push_notification) # RNOH_END: manual_package_linking_1 @@ -254,6 +275,10 @@ std::vector> PackageProvider::getPackages(Package::Cont ```diff ... + //<= V1.11.0-0.1.3 ++ import { PushNotificationPackage } from '@react-native-oh-tpl/push-notification-ios/ts'; + + //> V1.11.0 + import { PushNotificationPackage } from '@react-native-ohos/push-notification-ios/ts'; export function createRNPackages(ctx: RNPackageContext): RNPackage[] { @@ -270,6 +295,10 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { ```diff ... +//<= V1.11.0-0.1.3 ++ import { PushNotificationModule } from '@react-native-oh-tpl/push-notification-ios/ts'; + +//> V1.11.0 + import { PushNotificationModule } from '@react-native-ohos/push-notification-ios/ts'; ... onNewWant(want: Want, _launchParam: AbilityConstant.LaunchParam): void { @@ -294,7 +323,13 @@ ohpm install ### 3.1. 兼容性 -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-ohos/push-notification-ios Releases](https://gitee.com/openharmony-sig/rntpc_ios/releases) +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: +| Version | Package Name | Repository | Release | Version for RN | +| ------------------------- | ------------------------------------------------- | ------------------ | -------------------------- | ------------------------- | +| <= 1.11.0-0.1.3@deprecated | @react-native-oh-tpl/push-notification-ios | [Github(deprecated)](https://github.com/react-native-oh-library/react-native-push-notification-ios) | [Github Releases(deprecated)](https://github.com/react-native-oh-library/react-native-push-notification-ios/releases)| 0.72 | +| > 1.11.0 | @react-native-ohos/push-notification-ios | [GitCode](https://gitcode.com/openharmony-sig/rntpc_ios) | [GitCode Releases](https://gitcode.com/openharmony-sig/rntpc_ios/releases) | 0.72 | +| > 1.11.0 | @react-native-ohos/push-notification-ios | [GitCode](https://gitcode.com/openharmony-sig/rntpc_ios) | [GitCode Releases](https://gitcode.com/openharmony-sig/rntpc_ios/releases) | 0.77 | + ## 4. API diff --git a/zh-cn/react-native-default-preference.md b/zh-cn/react-native-default-preference.md index 7c9ddf0eb621852d30165a53ffd7806743f7c983..3f9c556bac752107693b65f1280f6de65fd3063b 100644 --- a/zh-cn/react-native-default-preference.md +++ b/zh-cn/react-native-default-preference.md @@ -18,7 +18,14 @@ ## 安装与使用 -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-default-preference Releases](https://github.com/react-native-oh-library/react-native-default-preference/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +请到三方库的 Releases 发布地址查看配套的版本信息: + +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 1.4.4 | [@react-native-oh-tpl/react-native-default-preference Releases](https://github.com/react-native-oh-library/react-native-default-preference/releases) | 0.72 | +| 1.4.5 | [@react-native-ohos/react-native-default-preference Releases]() | 0.77 | + +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 进入到工程目录并输入以下命令: @@ -28,13 +35,21 @@ #### **npm** ```bash +# V1.4.4 npm install @react-native-oh-tpl/react-native-default-preference + +# V1.4.5 +npm install @react-native-ohos/react-native-default-preference ``` #### **yarn** ```bash +# V1.4.4 yarn add @react-native-oh-tpl/react-native-default-preference + +# V1.4.5 +yarn add @react-native-ohos/react-native-default-preference ``` @@ -71,6 +86,10 @@ export default App; ## 使用 Codegen +> [!TIP] V1.4.4 不需要执行 Codegen。 + + + 本库已经适配了 `Codegen` ,在使用前需要主动执行生成三方库桥接代码,详细请参考[ Codegen 使用文档](/zh-cn/codegen.md)。 ## Link @@ -103,6 +122,8 @@ export default App; 打开 `entry/oh-package.json5`,添加以下依赖 +- V1.4.4 + ```json "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", @@ -110,6 +131,15 @@ export default App; } ``` +- V1.4.5 + +```json +"dependencies": { + "@rnoh/react-native-openharmony": "file:../react_native_openharmony", + "@react-native-ohos/react-native-default-preference": "file:../../node_modules/@react-native-ohos/react-native-default-preference/harmony/react_native_default_preference.har" + } +``` + 点击右上角的 `sync` 按钮 或者在终端执行: @@ -123,16 +153,80 @@ ohpm install > [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](/zh-cn/link-source-code.md) +### 3.配置 CMakeLists 和引入 DefaultPreferencePackage + +> [!TIP] 若使用的是 1.4.4 版本,请跳过本章。 -### 3.在 ArkTs 侧引入 RNDefaultPreferencePackage +打开 `entry/src/main/cpp/CMakeLists.txt`,添加: + +``` +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-default-preference/src/main/cpp" ./default_preference) +# 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_default_preference) +# RNOH_END: manual_package_linking_2 +``` + +打开 `entry/src/main/cpp/PackageProvider.cpp`,添加: + +``` +#include "RNOH/PackageProvider.h" +#include "generated/RNOHGeneratedPackage.h" +#include "SamplePackage.h" ++ #include "DefaultPreferencePackage.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 侧引入 RNDefaultPreferencePackage 打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: ```diff ... +// V1.4.4 + import { RNDefaultPreferencePackage } from '@react-native-oh-tpl/react-native-default-preference/ts'; +// V1.4.5 ++ import { RNDefaultPreferencePackage } from '@react-native-ohos/react-native-default-preference/ts'; + export function createRNPackages(ctx: RNPackageContext): RNPackage[] { return [ new SamplePackage(ctx), @@ -141,7 +235,7 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { } ``` -### 4.运行 +### 5.运行 点击右上角的 `sync` 按钮 @@ -161,7 +255,11 @@ ohpm install 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: -[@react-native-oh-tpl/react-native-default-preference Releases](https://github.com/react-native-oh-library/react-native-default-preference/releases) + +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 1.4.4 | [@react-native-oh-tpl/react-native-default-preference Releases](https://github.com/react-native-oh-library/react-native-default-preference/releases) | 0.72 | +| 1.4.5 | [@react-native-ohos/react-native-default-preference Releases]() | 0.77 | ## API diff --git a/zh-cn/react-native-linear-gradient.md b/zh-cn/react-native-linear-gradient.md index 6da3ab669741f57978124e8c2c7d6adb2441eb50..98f8ed859ee050e1f904139e32ae713045cf40da 100644 --- a/zh-cn/react-native-linear-gradient.md +++ b/zh-cn/react-native-linear-gradient.md @@ -6,12 +6,15 @@ 本项目基于 [react-native-linear-gradient@3.0.0-alpha.1](https://github.com/react-native-linear-gradient/react-native-linear-gradient) 开发。 -该第三方库的仓库已迁移至 Gitee,且支持直接从 npm 下载,新的包名为:`@react-native-ohos/react-native-linear-gradient`,具体版本所属关系如下: +该第三方库的仓库已迁移至 gitcode,且支持直接从 npm 下载,新的包名为:`@react-native-ohos/react-native-linear-gradient`,具体版本所属关系如下: + +| Version | Package Name | Repository | Release | Version for RN | +| ------------------------- | ------------------------------------------------- | ------------------ | -------------------------- | ------------------------- | +|<= 3.0.0-0.5.0@deprecated | @react-native-oh-tpl/react-native-linear-gradient | [Github(deprecated)](https://github.com/react-native-oh-library/react-native-linear-gradient) | [Github Releases(deprecated)](https://github.com/react-native-oh-library/react-native-linear-gradient/releases) | 0.72 | +| > 3.0.0 | @react-native-ohos/react-native-linear-gradient | [Gitcode](https://gitcode.com/openharmony-sig/rntpc_react-native-linear-gradient) | [Gitcode Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-linear-gradient/releases) | 0.72 | +| > 3.0.0 | @react-native-ohos/react-native-linear-gradient | [Gitcode](https://gitcode.com/openharmony-sig/rntpc_react-native-linear-gradient) | [Gitcode Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-linear-gradient/releases) | 0.77 | + -| Version | Package Name | Repository | Release | -| ------------------------- | ------------------------------------------------- | ------------------ | -------------------------- | -| <= 3.0.0-0.5.0@deprecated | @react-native-oh-tpl/react-native-linear-gradient | [Github(deprecated)](https://github.com/react-native-oh-library/react-native-linear-gradient) | [Github Releases(deprecated)](https://github.com/react-native-oh-library/react-native-linear-gradient/releases) | -| > 3.0.0 | @react-native-ohos/react-native-linear-gradient | [Gitee](https://gitee.com/openharmony-sig/rntpc_react-native-linear-gradient) | [Gitee Releases](https://gitee.com/openharmony-sig/rntpc_react-native-linear-gradient/releases) | ## 1. 安装与使用 @@ -22,12 +25,20 @@ #### **npm** ```bash +# <= V3.0.0 +npm install @react-native-oh-tpl/react-native-linear-gradient + +# > V3.0.0 npm install @react-native-ohos/react-native-linear-gradient ``` #### **yarn** ```bash +# <= V3.0.0 +yarn add @react-native-oh-tpl/react-native-linear-gradient + +# > V3.0.0 yarn add @react-native-ohos/react-native-linear-gradient ``` @@ -122,7 +133,15 @@ var styles = StyleSheet.create({ > [!TIP] har 包位于三方库安装路径的 `harmony` 文件夹下。 打开 `entry/oh-package.json5`,添加以下依赖 +- \<=V3.0.0 +```json +"dependencies": { + "@react-native-oh-tpl/react-native-linear-gradient": "file:../../node_modules/@react-native-oh-tpl/react-native-linear-gradient/harmony/linear_gradient.har" + } +``` + +- \>V3.0.0 ```json "dependencies": { "@react-native-ohos/react-native-linear-gradient": "file:../../node_modules/@react-native-ohos/react-native-linear-gradient/harmony/linear_gradient.har" @@ -192,7 +211,12 @@ ohpm install ### 3.1 兼容性 -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-ohos/react-native-linear-gradient Releases](https://gitee.com/openharmony-sig/rntpc_react-native-linear-gradient/releases) +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: +| Version | Package Name | Repository | Release | Version for RN | +| ------------------------- | ------------------------------------------------- | ------------------ | -------------------------- | ------------------------- | +|<= 3.0.0-0.5.0@deprecated | @react-native-oh-tpl/react-native-linear-gradient | [Github(deprecated)](https://github.com/react-native-oh-library/react-native-linear-gradient) | [Github Releases(deprecated)](https://github.com/react-native-oh-library/react-native-linear-gradient/releases) | 0.72 | +| > 3.0.0 | @react-native-ohos/react-native-linear-gradient | [Gitcode](https://gitcode.com/openharmony-sig/rntpc_react-native-linear-gradient) | [Gitcode Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-linear-gradient/releases) | 0.72 | +| > 3.0.0 | @react-native-ohos/react-native-linear-gradient | [Gitcode](https://gitcode.com/openharmony-sig/rntpc_react-native-linear-gradient) | [Gitcode Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-linear-gradient/releases) | 0.77 | ## 4. 属性 @@ -216,4 +240,4 @@ ohpm install ## 6. 开源协议 -本项目基于 [The MIT License (MIT)](https://gitee.com/openharmony-sig/rntpc_react-native-linear-gradient/blob/master/LICENSE),请自由地享受和参与开源。 +本项目基于 [The MIT License (MIT)](https://Gitcode.com/openharmony-sig/rntpc_react-native-linear-gradient/blob/master/LICENSE),请自由地享受和参与开源。 diff --git a/zh-cn/react-native-picker.md b/zh-cn/react-native-picker.md index 31abd4605173a3ee7fb79120ce76cad457348d08..0e4e02fa4ae4ad8d3f51ef66ec7a4c4db52fff86 100644 --- a/zh-cn/react-native-picker.md +++ b/zh-cn/react-native-picker.md @@ -16,22 +16,40 @@ ## 安装与使用 -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-picker Releases](https://github.com/react-native-oh-library/react-native-picker/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 + + +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 4.3.7 | [@react-native-oh-tpl/react-native-picker Releases](https://github.com/react-native-oh-library/react-native-picker/releases) | 0.72 | +| 4.3.8 | [@react-native-ohos/react-native-picker Releases]() | 0.77 | + +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 进入到工程目录并输入以下命令: + + #### **npm** ```bash +# V4.3.7 npm install @react-native-oh-tpl/react-native-picker + +# V4.3.8 +npm install @react-native-ohos/react-native-picker ``` #### **yarn** ```bash +# V4.3.7 yarn add @react-native-oh-tpl/react-native-picker + +# V4.3.8 +yarn add @react-native-ohos/react-native-picker ``` @@ -108,7 +126,15 @@ const MyPicker = () => { }; export default MyPicker; + + ``` +## 使用 Codegen + +> [!TIP] V4.3.8 不需要执行 Codegen。 + +本库已经适配了 `Codegen` ,在使用前需要主动执行生成三方库桥接代码,详细请参考[ Codegen 使用文档](https://gitee.com/react-native-oh-library/usage-docs/blob/39316eccca7657d77dfdc9e90cfbf64e6a7713f3/zh-cn/codegen.md)。 + ## Link 目前 HarmonyOS 暂不支持 AutoLink,所以 Link 步骤需要手动配置。 @@ -139,13 +165,20 @@ export default MyPicker; 打开 `entry/oh-package.json5`,添加以下依赖 +- V4.3.7 ```json "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", "@react-native-oh-tpl/react-native-picker": "file:../../node_modules/@react-native-oh-tpl/react-native-picker/harmony/picker.har" } ``` - +- V4.3.8 +```json +"dependencies": { + "@rnoh/react-native-openharmony": "file:../react_native_openharmony", + "@react-native-oh-tpl/react-native-picker": "file:../../node_modules/@react-native-ohos/react-native-picker/harmony/picker.har" + } +``` 点击右上角的 `sync` 按钮 或者在终端执行: @@ -181,7 +214,11 @@ add_subdirectory("${RNOH_CPP_DIR}" ./rn) # RNOH_BEGIN: manual_package_linking_1 add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) +# V4.3.7 + add_subdirectory("${OH_MODULES}/@react-native-oh-tpl/react-native-picker/src/main/cpp" ./picker) + +# V4.3.8 ++ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-picker/src/main/cpp" ./picker) # RNOH_END: manual_package_linking_1 file(GLOB GENERATED_CPP_FILES "./generated/*.cpp") @@ -195,7 +232,11 @@ target_link_libraries(rnoh_app PUBLIC rnoh) # RNOH_BEGIN: manual_package_linking_2 target_link_libraries(rnoh_app PUBLIC rnoh_sample_package) +# V4.3.7 + target_link_libraries(rnoh_app PUBLIC rnoh_native_picker) + +# V4.3.8 ++ target_link_libraries(rnoh_app PUBLIC rnoh_picker) # RNOH_END: manual_package_linking_2 ``` @@ -221,10 +262,12 @@ std::vector> PackageProvider::getPackages(Package::Cont ### 4.在 ArkTs 侧引入 PickerViewPackage 打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: - ```diff ... + // V4.3.7 + import { PickerViewPackage } from "@react-native-oh-tpl/react-native-picker/ts" + // V4.3.8 ++ import { PickerViewPackage } from "@react-native-ohos/react-native-picker/ts" export function createRNPackages(ctx: RNPackageContext): RNPackage[] { return [ @@ -232,7 +275,6 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { ]; } ``` - ### 5.运行 点击右上角的 `sync` 按钮 @@ -252,7 +294,11 @@ ohpm install 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/react-native-picker Releases](https://github.com/react-native-oh-library/react-native-picker/releases) +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 4.3.7 | [@react-native-oh-tpl/react-native-picker Releases](https://github.com/react-native-oh-library/react-native-picker/releases) | 0.72 | +| 4.3.8 | [@react-native-ohos/react-native-picker Releases]() | 0.77 | ## 属性 diff --git a/zh-cn/react-native-send-intent.md b/zh-cn/react-native-send-intent.md index fe55d9e85457b77bd51e2961356cc328ad4d9d16..5eb3872b1e5eaf843eac8f96b327b6aedd651ebb 100644 --- a/zh-cn/react-native-send-intent.md +++ b/zh-cn/react-native-send-intent.md @@ -16,7 +16,14 @@ ## 安装与使用 -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-send-intent Releases](https://github.com/react-native-oh-library/react-native-send-intent/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +请到三方库的 Releases 发布地址查看配套的版本信息: + +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 1.3.0 | [@react-native-oh-tpl/react-native-send-intent Releases](https://github.com/react-native-oh-library/react-native-send-intent/releases) | 0.72 | +| 1.3.1 | [@react-native-ohos/react-native-send-intent Releases]() | 0.77 | + +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 进入到工程目录并输入以下命令: @@ -26,13 +33,21 @@ #### npm ```bash +# V1.3.0 npm install @react-native-oh-tpl/react-native-send-intent + +# V1.3.1 +npm install @react-native-ohos/react-native-send-intent ``` #### yarn ```bash +# V1.3.0 yarn add @react-native-oh-tpl/react-native-send-intent + +# V1.3.1 +yarn add @react-native-ohos/react-native-send-intent ``` @@ -139,6 +154,10 @@ export default SendIntent; ## 使用 Codegen +> [!TIP] V1.3.1 不需要执行 Codegen。 + + + 本库已经适配了 `Codegen` ,在使用前需要主动执行生成三方库桥接代码,详细请参考[ Codegen 使用文档](/zh-cn/codegen.md)。 ## Link @@ -171,12 +190,24 @@ export default SendIntent; 打开 `entry/oh-package.json5`,添加以下依赖 +- V1.3.0 + ```json "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", "@react-native-oh-tpl/react-native-send-intent": "file:../../node_modules/@react-native-oh-tpl/react-native-send-intent/harmony/send_intent.har" } ``` + +- V1.3.1 + +```json +"dependencies": { + "@rnoh/react-native-openharmony": "file:../react_native_openharmony", + "@react-native-ohos/react-native-send-intent": "file:../../node_modules/@react-native-ohos/react-native-send-intent/harmony/send_intent.har" + } +``` + 点击右上角的 `sync` 按钮 或者在终端执行: @@ -190,14 +221,78 @@ ohpm install > [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](/zh-cn/link-source-code.md) -### 3.在 ArkTs 侧引入 RNSendIntentPackage +### 3.配置 CMakeLists 和引入 SendIntentPackage + +> [!TIP] 若使用的是 1.3.0 版本,请跳过本章。 + +打开 `entry/src/main/cpp/CMakeLists.txt`,添加: + +``` +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-send-intent/src/main/cpp" ./send_intent) +# 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_send_intent) +# RNOH_END: manual_package_linking_2 +``` + +打开 `entry/src/main/cpp/PackageProvider.cpp`,添加: + +``` +#include "RNOH/PackageProvider.h" +#include "generated/RNOHGeneratedPackage.h" +#include "SamplePackage.h" ++ #include "SendIntentPackage.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 侧引入 RNSendIntentPackage 打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: ```diff ... +// V1.3.0 + import {RNSendIntentPackage} from '@react-native-oh-tpl/react-native-send-intent/ts'; +// V1.3.1 ++ import {RNSendIntentPackage} from '@react-native-ohos/react-native-send-intent/ts'; export function createRNPackages(ctx: RNPackageContext): RNPackage[] { return [ @@ -207,7 +302,7 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { } ``` -### 4.运行 +### 5.运行 点击右上角的 `sync` 按钮 @@ -226,7 +321,12 @@ ohpm install 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/react-native-send-intent Releases](https://github.com/react-native-oh-library/react-native-send-intent/releases) +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: + +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 1.3.0 | [@react-native-oh-tpl/react-native-send-intent Releases](https://github.com/react-native-oh-library/react-native-send-intent/releases) | 0.72 | +| 1.3.1 | [@react-native-ohos/react-native-send-intent Releases]() | 0.77 | ## API diff --git a/zh-cn/react-native-udp.md b/zh-cn/react-native-udp.md index 78e185ee9ea56ad0d904f86fdc6accbe214c8ee0..f2bfad9b860fbf7bc9bd554630b4eb2393ff755e 100644 --- a/zh-cn/react-native-udp.md +++ b/zh-cn/react-native-udp.md @@ -18,20 +18,35 @@ ## 安装与使用 -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-udp Releases](https://github.com/react-native-oh-library/react-native-udp/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +请到三方库的 Releases 发布地址查看配套的版本信息: + +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 4.1.7 | [@react-native-oh-tpl/react-native-udp Releases](https://github.com/react-native-oh-library/react-native-udp/releases) | 0.72 | +| 4.1.8 | [@react-native-ohos/react-native-udp Releases]() | 0.77 | + +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 进入到工程目录并输入以下命令: #### **npm** ```bash +# V4.1.7 npm install @react-native-oh-tpl/react-native-udp + +# V4.1.8 +npm install @react-native-ohos/react-native-udp ``` #### **yarn** ```bash +# V4.1.7 yarn add @react-native-oh-tpl/react-native-udp + +# V4.1.8 +yarn add @react-native-ohos/react-native-udp ``` 下面的代码展示了这个库的基本使用场景: @@ -158,6 +173,10 @@ export default App; ## 使用 Codegen +> [!TIP] V4.1.8 不需要执行 Codegen。 + + + 本库已经适配了 `Codegen` ,在使用前需要主动执行生成三方库桥接代码,详细请参考[ Codegen 使用文档](/zh-cn/codegen.md)。 ## Link @@ -190,6 +209,8 @@ export default App; 打开 `entry/oh-package.json5`,添加以下依赖 +- V4.1.7 + ```json "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", @@ -197,6 +218,15 @@ export default App; } ``` +- V4.1.8 + +```json +"dependencies": { + "@rnoh/react-native-openharmony": "file:../react_native_openharmony", + "@react-native-ohos/react-native-udp": "file:../../node_modules/@react-native-ohos/react-native-udp/harmony/react_native_udp.har" + } +``` + 点击右上角的 `sync` 按钮 或者在终端执行: @@ -212,15 +242,80 @@ ohpm install -### 3.在 ArkTs 侧引入 RNUdpPackage +### 3.配置 CMakeLists 和引入 UdpPackage + +> [!TIP] 若使用的是 4.1.7 版本,请跳过本章。 + +打开 `entry/src/main/cpp/CMakeLists.txt`,添加: + +``` +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-udp/src/main/cpp" ./udp) +# 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_udp) +# RNOH_END: manual_package_linking_2 +``` + +打开 `entry/src/main/cpp/PackageProvider.cpp`,添加: + +``` +#include "RNOH/PackageProvider.h" +#include "generated/RNOHGeneratedPackage.h" +#include "SamplePackage.h" ++ #include "UdpPackage.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 侧引入 RNUdpPackage 打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: ```diff ... +// V4.1.7 + import {RNUdpPackage} from '@react-native-oh-tpl/react-native-udp/ts'; +// V4.1.8 ++ import {RNUdpPackage} from '@react-native-ohos/react-native-udp/ts'; + export function createRNPackages(ctx: RNPackageContext): RNPackage[] { return [ new SamplePackage(ctx), @@ -229,7 +324,7 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { } ``` -### 4.运行 +### 5.运行 点击右上角的 `sync` 按钮 @@ -248,9 +343,12 @@ ohpm install 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/react-native-udp Releases](https://github.com/react-native-oh-library/react-native-udp/releases) - +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 4.1.7 | [@react-native-oh-tpl/react-native-udp Releases](https://github.com/react-native-oh-library/react-native-udp/releases) | 0.72 | +| 4.1.8 | [@react-native-ohos/react-native-udp Releases]() | 0.77 | ## API diff --git a/zh-cn/react-native-view-pdf.md b/zh-cn/react-native-view-pdf.md index b9d97e1f562a10077f101fb8e09059ec33d3a6c8..b9098b59a9bb03e771cdf5db907739cfe2ae8882 100644 --- a/zh-cn/react-native-view-pdf.md +++ b/zh-cn/react-native-view-pdf.md @@ -16,7 +16,14 @@ ## 安装与使用 -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-view-pdf Releases](https://github.com/react-native-oh-library/react-native-PDFView/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +请到三方库的 Releases 发布地址查看配套的版本信息: + +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 0.14.0 | [@react-native-oh-tpl/react-native-view-pdf Releases](https://github.com/react-native-oh-library/react-native-PDFView/releases) | 0.72 | +| 0.14.1 | [@react-native-ohos/react-native-view-pdf Releases]() | 0.77 | + +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 进入到工程目录并输入以下命令: @@ -25,13 +32,21 @@ #### **npm** ```bash +# V0.14.0 npm install @react-native-oh-tpl/react-native-view-pdf + +# V0.14.1 +npm install @react-native-ohos/react-native-view-pdf ``` #### **yarn** ```bash +# V0.14.0 yarn add @react-native-oh-tpl/react-native-view-pdf + +# V0.14.1 +yarn add @react-native-ohos/react-native-view-pdf ``` @@ -60,6 +75,10 @@ export function PdfViewExample() { ## 使用 Codegen +> [!TIP] V0.14.1 不需要执行 Codegen。 + + + 本库已经适配了 `Codegen` ,在使用前需要主动执行生成三方库桥接代码,详细请参考[ Codegen 使用文档](/zh-cn/codegen.md)。 ## Link @@ -92,6 +111,8 @@ export function PdfViewExample() { 打开 `entry/oh-package.json5`,添加以下依赖 +- V0.14.0 + ```json "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", @@ -99,6 +120,15 @@ export function PdfViewExample() { } ``` +- V0.14.1 + +```json +"dependencies": { + "@rnoh/react-native-openharmony": "file:../react_native_openharmony", + "@react-native-ohos/react-native-view-pdf": "file:../../node_modules/@react-native-ohos/react-native-view-pdf/harmony/pdf_view.har" + } +``` + 点击右上角的 `sync` 按钮 或者在终端执行: @@ -118,8 +148,12 @@ ohpm install ```diff ... +// V0.14.0 + import { RNPDFView } from '@react-native-oh-tpl/react-native-view-pdf' +// V0.14.1 ++ import { RNPDFView } from '@react-native-ohos/react-native-view-pdf' + @Builder export function buildCustomRNComponent(ctx: ComponentBuilderContext) { ... @@ -147,14 +181,79 @@ const arkTsComponentNames: Array = [ ]; ``` -### 4.在 ArkTs 侧引入 PDFViewPackage +### 4.配置 CMakeLists 和引入 ViewPdfPackage + +> [!TIP] 若使用的是 0.14.0 版本,请跳过本章。 + +打开 `entry/src/main/cpp/CMakeLists.txt`,添加: + +``` +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-view-pdf/src/main/cpp" ./pdf_view) +# 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_pdf_view) +# RNOH_END: manual_package_linking_2 +``` + +打开 `entry/src/main/cpp/PackageProvider.cpp`,添加: + +``` +#include "RNOH/PackageProvider.h" +#include "generated/RNOHGeneratedPackage.h" +#include "SamplePackage.h" ++ #include "ViewPdfPackage.h" + +using namespace rnoh; + +std::vector> PackageProvider::getPackages(Package::Context ctx) { + return { + std::make_shared(ctx), + std::make_shared(ctx), ++ std::make_shared(ctx), + }; +} +``` + +### 5.在 ArkTs 侧引入 PDFViewPackage 打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: ```diff ... +// V0.14.0 + import { PDFViewPackage } from '@react-native-oh-tpl/react-native-view-pdf/ts' +// V0.14.1 ++ import { PDFViewPackage } from '@react-native-ohos/react-native-view-pdf/ts' + export function createRNPackages(ctx: RNPackageContext): RNPackage[] { return [ new SamplePackage(ctx), @@ -163,7 +262,7 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { } ``` -### 5.运行 +### 6.运行 点击右上角的 `sync` 按钮 @@ -180,7 +279,12 @@ ohpm install 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/react-native-view-pdf Releases](https://github.com/react-native-oh-library/react-native-PDFView/releases) +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: + +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 0.14.0 | [@react-native-oh-tpl/react-native-view-pdf Releases](https://github.com/react-native-oh-library/react-native-PDFView/releases) | 0.72 | +| 0.14.1 | [@react-native-ohos/react-native-view-pdf Releases]() | 0.77 | ## 属性