diff --git a/zh-cn/react-native-hole-view.md b/zh-cn/react-native-hole-view.md index 034cbdd9ed229a4b626112a03e1315b4883a73ac..b099a329634fe248a307cbf62b2d013d4fd66f95 100644 --- a/zh-cn/react-native-hole-view.md +++ b/zh-cn/react-native-hole-view.md @@ -18,24 +18,37 @@ ## 安装与使用 -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-library/react-native-hole-view Releases](https://github.com/react-native-oh-library/react-native-hole-view/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +请到三方库的 Releases 发布地址查看配套的版本信息: -进入到工程目录并输入以下命令: +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 3.0.0 | [@react-native-oh-library/react-native-hole-view Releases](https://github.com/react-native-oh-library/react-native-hole-view/releases) | 0.72 | +| 3.0.2 | [@react-native-ohos/react-native-hole-view Releases]() | 0.77 | +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +进入到工程目录并输入以下命令: #### npm ```bash +# V3.0.0 npm install @react-native-oh-tpl/react-native-hole-view + +# V3.0.2 +npm install @react-native-ohos/react-native-hole-view ``` #### yarn ```bash +# V3.0.0 yarn add @react-native-oh-tpl/react-native-hole-view + +# V3.0.2 +yarn add @react-native-ohos/react-native-hole-view ``` @@ -168,6 +181,8 @@ export default App; 打开 `entry/oh-package.json5`,添加以下依赖 +- V3.0.0 + ```json "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", @@ -175,6 +190,15 @@ export default App; } ``` +- V3.0.2 + +```json +"dependencies": { + "@rnoh/react-native-openharmony": "file:../react_native_openharmony", + "@react-native-ohos/react-native-hole-view": "file:../../node_modules/@react-native-ohos/react-native-hole-view/harmony/rnoh_holeview.har" + } +``` + 点击右上角的 `sync` 按钮 或者在终端执行: @@ -210,7 +234,12 @@ add_subdirectory("${RNOH_CPP_DIR}" ./rn) # RNOH_BEGIN: manual_package_linking_1 add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) +// V3.0.0 + add_subdirectory("${OH_MODULES}/@react-native-oh-tpl/react-native-hole-view/src/main/cpp" ./rnohkeys) + +// V3.0.2 ++ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-hole-view/src/main/cpp" ./rnohkeys) + # RNOH_END: manual_package_linking_1 file(GLOB GENERATED_CPP_FILES "./generated/*.cpp") @@ -266,9 +295,14 @@ ohpm install 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-library/react-native-hole-view Releases](https://github.com/react-native-oh-library/react-native-hole-view/releases) +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: + +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 3.0.0 | [@react-native-oh-library/react-native-hole-view Releases](https://github.com/react-native-oh-library/react-native-hole-view/releases) | 0.72 | +| 3.0.2 | [@react-native-ohos/react-native-hole-view Releases]() | 0.77 | + - ## 属性 > [!TIP] "Platform"列表示该属性在原三方库上支持的平台。 diff --git a/zh-cn/react-native-incall-manager.md b/zh-cn/react-native-incall-manager.md index 9715c6be8396835d32aba5b3bc9a79b85004636e..0894d2faca177936716e7bd1ae917cc425fd99e2 100644 --- a/zh-cn/react-native-incall-manager.md +++ b/zh-cn/react-native-incall-manager.md @@ -21,25 +21,37 @@ ## 安装与使用 +请到三方库的 Releases 发布地址查看配套的版本信息: -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-incall-manager Releases](https://github.com/react-native-oh-library/react-native-incall-manager/releases)。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 - -进入到工程目录并输入以下命令: +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 4.2.0 | [@react-native-oh-tpl/react-native-incall-manager Releases](https://github.com/react-native-oh-library/react-native-incall-manager/releases) | 0.72 | +| 4.2.2 | [@react-native-ohos/react-native-incall-manager Releases]() | 0.77 | +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +进入到工程目录并输入以下命令: #### **npm** ```bash +# V4.2.0 npm install @react-native-oh-tpl/react-native-incall-manager + +# V4.2.2 +npm install @react-native-ohos/react-native-incall-manager ``` #### **yarn** ```bash +# V4.2.0 yarn add @react-native-oh-tpl/react-native-incall-manager + +# V4.2.2 +yarn add @react-native-ohos/react-native-incall-manager ``` @@ -519,14 +531,24 @@ export default function InCallManagerExample() { 打开 `entry/oh-package.json5`,添加以下依赖 +- V4.2.0 + ```json "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", - "@react-native-oh-tpl/react-native-incall-manager": "file:../../node_modules/@react-native-oh-tpl/react-native-incall-manager/harmony/in_call_manager.har" } ``` +- V4.2.2 + +```JSON +"dependencies": { + "@rnoh/react-native-openharmony": "file:../react_native_openharmony", + "@react-native-ohos/react-native-incall-manager": "file:../../node_modules/@react-native-ohos/react-native-incall-manager/harmony/in_call_manager.har" + } +``` + 点击右上角的 `sync` 按钮 或者在终端执行: @@ -562,7 +584,11 @@ add_subdirectory("${RNOH_CPP_DIR}" ./rn) # RNOH_BEGIN: manual_package_linking_1 add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) +// V4.2.0 + add_subdirectory("${OH_MODULES}/@react-native-oh-tpl/react-native-incall-manager/src/main/cpp" ./in_call_manager) + +// V4.2.2 ++ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-incall-manager/src/main/cpp" ./in_call_manager) # RNOH_END: manual_package_linking_1 file(GLOB GENERATED_CPP_FILES "./generated/*.cpp") @@ -602,8 +628,12 @@ std::vector> PackageProvider::getPackages(Package::Cont 打开 `entry/src/main/ets/RNPackagesFactory.ts`,或者`entry/src/main/ets/rn/RNPackagesFactory.ts`,添加: ```diff +// V4.2.0 + import { RNInCallManagerPackage } from '@react-native-oh-tpl/react-native-incall-manager/ts'; +// V4.2.2 ++ import { RNInCallManagerPackage } from '@react-native-ohos/react-native-incall-manager/ts'; + export function createRNPackages(ctx: RNPackageContext): RNPackage[] { return [ new SamplePackage(ctx), @@ -631,7 +661,12 @@ ohpm install 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/react-native-incall-manager Releases](https://github.com/react-native-oh-library/react-native-incall-manager/releases) +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: + +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 4.2.0 | [@react-native-oh-tpl/react-native-incall-manager Releases](https://github.com/react-native-oh-library/react-native-incall-manager/releases) | 0.72 | +| 4.2.2 | [@react-native-ohos/react-native-incall-manager Releases]() | 0.77 | ### 应用权限申请 @@ -683,8 +718,6 @@ ohpm install } ``` - - ## 静态方法 > [!TIP] "Platform"列表示该属性在原三方库上支持的平台。 diff --git a/zh-cn/react-native-localization.md b/zh-cn/react-native-localization.md index d63e60a9ab0d4108b66ff14968d3e362f2bc441e..fbcc3e282b05aa6fd5ce6104e46e081a61c80941 100644 --- a/zh-cn/react-native-localization.md +++ b/zh-cn/react-native-localization.md @@ -21,7 +21,14 @@ ## 安装与使用 -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-localization Releases](https://github.com/react-native-oh-library/ReactNativeLocalization/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +请到三方库的 Releases 发布地址查看配套的版本信息: + +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 2.3.2 | [@react-native-oh-tpl/react-native-localization Releases](https://github.com/react-native-oh-library/ReactNativeLocalization/releases) | 0.72 | +| 2.3.3 | [@react-native-ohos/react-native-localization Releases]() | 0.77 | + + 对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 进入到工程目录并输入以下命令: @@ -30,13 +37,21 @@ #### **npm** ```bash +#2.3.2 npm install @react-native-oh-tpl/react-native-localization + +#2.3.3 +npm install @react-native-ohos/react-native-localization ``` #### **yarn** ```bash +#2.3.2 yarn add @react-native-oh-tpl/react-native-localization + +#2.3.3 +yarn add @react-native-ohos/react-native-localization ``` @@ -170,6 +185,8 @@ const styles = StyleSheet.create({ ``` ## 使用 Codegen +> [!TIP] V2.3.3 不需要执行 Codegen。 + 本库已经适配了 `Codegen` ,在使用前需要主动执行生成三方库桥接代码,详细请参考[ Codegen 使用文档](/zh-cn/codegen.md)。 ## Link @@ -202,6 +219,8 @@ const styles = StyleSheet.create({ 打开 `entry/oh-package.json5`,添加以下依赖 +- V2.3.2 + ```json "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", @@ -209,6 +228,15 @@ const styles = StyleSheet.create({ } ``` +- V2.3.3 + +```json +"dependencies": { + "@rnoh/react-native-openharmony": "file:../react_native_openharmony", + "@react-native-ohos/react-native-localization": "file:../../node_modules/@react-native-ohos/react-native-localization/harmony/react_localization.har" + } +``` + 点击右上角的 `sync` 按钮 或者在终端执行: @@ -228,7 +256,10 @@ ohpm install ```diff ... + //2.3.2 + import { RNReactLocalizationPackage } from '@react-native-oh-tpl/react-native-localization'; + //2.3.3 ++ import { RNReactLocalizationPackage } from '@react-native-ohos/react-native-localization/ts'; export function createRNPackages(ctx: RNPackageContext): RNPackage[] { return [ @@ -238,7 +269,68 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { } ``` -### 4.运行 +### 4.配置 CMakeLists 和引入 LocalizationPackage + +> [!TIP] V2.3.3 需要执行 + +打开 `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-localization/src/main/cpp" ./localization) +# 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_localization) +# 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 "LocalizationPackage.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.运行 点击右上角的 `sync` 按钮 @@ -257,7 +349,12 @@ ohpm install 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/react-native-localization Releases](https://github.com/react-native-oh-library/ReactNativeLocalization/releases) +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: + +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 2.3.2 | [@react-native-oh-tpl/react-native-localization Releases](https://github.com/react-native-oh-library/ReactNativeLocalization/releases) | 0.72 | +| 2.3.3 | [@react-native-ohos/react-native-localization Releases]() | 0.77 | diff --git a/zh-cn/react-native-sound.md b/zh-cn/react-native-sound.md index 0d587be5c9b683f99d32adb172430e278170a335..a3f79b886f42ba93b629d16d9da4f1c84fe564ac 100644 --- a/zh-cn/react-native-sound.md +++ b/zh-cn/react-native-sound.md @@ -23,7 +23,11 @@ ## 安装与使用 -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-library/react-native-sound Releases](https://github.com/react-native-oh-library/react-native-sound/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 0.11.2 |[@react-native-oh-tpl/react-native-sound Releases](https://github.com/react-native-oh-library/react-native-sound/releases)| 0.72 | +| 0.12.0 |[@react-native-ohos/react-native-sound Releases]() | 0.77 | 进入到工程目录并输入以下命令: @@ -32,12 +36,20 @@ #### npm ```bash +# V0.11.2 +npm install @react-native-oh-tpl/react-native-sound + +# V0.12.0 npm install @react-native-ohos/react-native-sound ``` #### yarn ```bash +# V0.11.2 +yarn add @react-native-oh-tpl/react-native-sound + +# V0.12.0 yarn add @react-native-ohos/react-native-sound ``` @@ -160,6 +172,12 @@ const styles = StyleSheet.create({ export default SoundDemo; ``` +## 使用 Codegen + +> [!TIP] V0.12.0 不需要执行 Codegen。 + +本库已经适配了 `Codegen` ,在使用前需要主动执行生成三方库桥接代码,详细请参考[ Codegen 使用文档](https://gitee.com/react-native-oh-library/usage-docs/blob/39316eccca7657d77dfdc9e90cfbf64e6a7713f3/zh-cn/codegen.md)。 + ## Link Version >= @react-native-ohos/react-native-sound@0.11.3,已支持 Autolink,无需手动配置。 @@ -193,6 +211,16 @@ Version <= @react-native-oh-tpl/react-native-sound@0.11.2-0.0.13@deprecated 暂 打开 `entry/oh-package.json5`,添加以下依赖 +- V0.11.2 + +```json +"dependencies": { + "@rnoh/react-native-openharmony": "file:../react_native_openharmony", + "@react-native-ohos/react-native-sound": "file:../../node_modules/@react-native-ohos/react-native-sound/harmony/sound.har" + } +``` + +- V0.12.0 ```json "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", @@ -235,7 +263,13 @@ add_subdirectory("${RNOH_CPP_DIR}" ./rn) # RNOH_BEGIN: manual_package_linking_1 add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) + +# V0.11.2 ++ add_subdirectory("${OH_MODULES}/@react-native-oh-tpl/react-native-sound/src/main/cpp" ./sound) + +# V0.12.0 + add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-sound/src/main/cpp" ./sound) + # RNOH_BEGIN: manual_package_linking_1 add_library(rnoh_app SHARED @@ -271,7 +305,7 @@ std::vector> PackageProvider::getPackages(Package::Cont ### 4.在 ArkTs 侧引入 SoundPackage 打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: - +- V0.11.2 ```diff ... + import { SoundPackage } from '@react-native-ohos/react-native-sound/ts'; @@ -283,7 +317,18 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { ]; } ``` +- V0.12.0 +```diff + ... ++ import { SoundPackage } from '@react-native-ohos/react-native-sound/ts'; +export function createRNPackages(ctx: RNPackageContext): RNPackage[] { + return [ + new SamplePackage(ctx), ++ new SoundPackage(ctx) + ]; +} +``` ### 5.运行 点击右上角的 `sync` 按钮 @@ -303,7 +348,11 @@ ohpm install 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-library/react-native-sound Releases](https://github.com/react-native-oh-library/react-native-sound/releases) +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 0.11.2 |[@react-native-oh-tpl/react-native-sound Releases](https://github.com/react-native-oh-library/react-native-sound/releases)| 0.72 | +| 0.12.0 |[@react-native-ohos/react-native-sound Releases]() | 0.77 | ## 静态方法 diff --git a/zh-cn/react-native-syan-image-picker.md b/zh-cn/react-native-syan-image-picker.md index 5a89695dbe41c4147982f4a7e59781fb022d0f80..283b9fb1971657b52479e17f7c9309ae0f74a638 100644 --- a/zh-cn/react-native-syan-image-picker.md +++ b/zh-cn/react-native-syan-image-picker.md @@ -17,7 +17,14 @@ ## 安装与使用 -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-syan-image-picker Releases](https://github.com/react-native-oh-library/react-native-syan-image-picker/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +请到三方库的 Releases 发布地址查看配套的版本信息: + +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 0.5.3 | [@react-native-oh-tpl/react-native-syan-image-picker Releases](https://github.com/react-native-oh-library/react-native-syan-image-picker/releases) | 0.72 | +| 0.5.4 | [@react-native-ohos/react-native-syan-image-picker Releases]() | 0.77 | + +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 进入到工程目录并输入以下命令: @@ -26,13 +33,19 @@ #### **npm** ```bash +#v0.5.3 npm install @react-native-oh-tpl/react-native-syan-image-picker +#v0.5.4 +npm install @react-native-ohos/react-native-syan-image-picker ``` #### **yarn** ```bash +#v0.5.3 yarn add @react-native-oh-tpl/react-native-syan-image-picker +#v0.5.4 +yarn add @react-native-ohos/react-native-syan-image-picker ``` @@ -309,6 +322,8 @@ const styles = StyleSheet.create({ ## 使用 Codegen +> [!TIP] V0.5.4 不需要执行 Codegen。 + 本库已经适配了 `Codegen` ,在使用前需要主动执行生成三方库桥接代码,详细请参考[ Codegen 使用文档](/zh-cn/codegen.md)。 ## Link @@ -442,6 +457,8 @@ struct ImageEdit { 打开 `entry/oh-package.json5`,添加以下依赖 +- V0.5.3 + ```json "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", @@ -449,6 +466,15 @@ struct ImageEdit { } ``` +- V0.5.4 + +```json +"dependencies": { + "@rnoh/react-native-openharmony": "file:../react_native_openharmony", + "@react-native-ohos/react-native-syan-image-picker": "file:../../node_modules/@react-native-ohos/react-native-syan-image-picker/harmony/syan_image_picker.har" + } +``` + 点击右上角的 `sync` 按钮 或者在终端执行: @@ -462,13 +488,77 @@ ohpm install > [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](/zh-cn/link-source-code.md) -### 4.在 ArkTs 侧引入SyanImagePickerPackage +### 4.配置 CMakeLists 和引入 ImageMarkerPackage + +> [!TIP] 若使用的是 1.2.6 版本,请跳过本章。 + +打开 `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-syan-image-picker/src/main/cpp" ./syan_image_picker) +# 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_syan_image_picker) +# RNOH_END: manual_package_linking_2 +``` + +打开 `entry/src/main/cpp/PackageProvider.cpp`,添加: + +``` +#include "RNOH/PackageProvider.h" +#include "generated/RNOHGeneratedPackage.h" +#include "SamplePackage.h" ++ #include "SyanImagePickerPackage.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 侧引入 RNImageMarkerPackage 打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: ```diff ... +//v0.5.3 + import {SyanImagePickerPackage} from '@react-native-oh-tpl/react-native-syan-image-picker/ts'; +//v0.5.4 ++ import {SyanImagePickerPackage} from '@react-native-ohos/react-native-syan-image-picker/ts'; export function createRNPackages(ctx: RNPackageContext): RNPackage[] { return [ @@ -478,7 +568,7 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { } ``` -### 5.运行 +### 6.运行 点击右上角的 `sync` 按钮 @@ -497,7 +587,12 @@ ohpm install 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/react-native-syan-image-picker Releases](https://github.com/react-native-oh-library/react-native-syan-image-picker/releases) +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: + +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 0.5.3 | [@react-native-oh-tpl/react-native-syan-image-picker Releases](https://github.com/react-native-oh-library/react-native-syan-image-picker/releases) | 0.72 | +| 0.5.4 | [@react-native-ohos/react-native-syan-image-picker Releases]() | 0.77 | 本文档内容基于以下版本验证通过: diff --git a/zh-cn/rn-tourguide.md b/zh-cn/rn-tourguide.md index c62d9c79afebd728d65fdf3134fe46c694e36dbe..73c6e507dc31c79bc197effe7110de553297642f 100644 --- a/zh-cn/rn-tourguide.md +++ b/zh-cn/rn-tourguide.md @@ -18,7 +18,14 @@ ## 安装与使用 -请到三方库的 Releases 发布地址查看配套的版本信息:[https://github.com/react-native-oh-library/rn-tourguide Releases](https://github.com/react-native-oh-library/rn-tourguide/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +请到三方库的 Releases 发布地址查看配套的版本信息: + +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 3.3.0 | [https://github.com/react-native-oh-library/rn-tourguide Releases](https://github.com/react-native-oh-library/rn-tourguide/releases) | 0.72 | +| 3.3.3 | [@react-native-ohos/rn-tourguide Releases]() | 0.77 | + +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 进入到工程目录并输入以下命令: @@ -27,13 +34,21 @@ #### **npm** ```bash +# V3.3.0 npm install @react-native-oh-tpl/rn-tourguide + +# V3.3.3 +npm install @react-native-ohos/rn-tourguide ``` #### **yarn** ```bash +# V3.3.0 yarn add @react-native-oh-tpl/rn-tourguide + +# V3.3.3 +yarn add @react-native-ohos/rn-tourguide ```