diff --git a/zh-cn/react-native-background-timer.md b/zh-cn/react-native-background-timer.md index 54c4423d06161a86c1ebab07b3e76b4c9d489cca..acd0208ea57e54306b1869f5408bad255846786b 100644 --- a/zh-cn/react-native-background-timer.md +++ b/zh-cn/react-native-background-timer.md @@ -6,12 +6,12 @@ 本项目基于 [react-native-background-timer@2.4.1](https://github.com/ocetnik/react-native-background-timer) 开发。 -该第三方库的仓库已迁移至 Gitee,且支持直接从 npm 下载,新的包名为:`@react-native-ohos/react-native-background-timer`,具体版本所属关系如下: +该第三方库的仓库已迁移至 GitCode,且支持直接从 npm 下载,新的包名为:`@react-native-ohos/react-native-background-timer`,具体版本所属关系如下: | Version | Package Name | Repository | Release | | ------------------------- | ------------------------------------------------- | ------------------ | -------------------------- | | <= 2.4.1-0.0.2@deprecated | @react-native-oh-tpl/react-native-background-timer | [Github(deprecated)](https://github.com/react-native-oh-library/react-native-background-timer) | [Github Releases(deprecated)](https://github.com/react-native-oh-library/react-native-background-timer/releases) | -| > 2.4.2 | @react-native-ohos/react-native-background-timer | [Gitee](https://gitee.com/openharmony-sig/rntpc_react-native-background-timer) | [Gitee Releases](https://gitee.com/openharmony-sig/rntpc_react-native-background-timer/releases) | +| > 2.4.2 | @react-native-ohos/react-native-background-timer | [GitCode](https://gitcode.com/openharmony-sig/rntpc_react-native-background-timer) | [GitCode Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-background-timer/releases) | ## 1. 安装与使用 @@ -215,7 +215,7 @@ const styles = StyleSheet.create({ ```json { "overrides": { - "@rnoh/react-native-openharmony": "^0.72.38" // ohpm 在线版本 + "@rnoh/react-native-openharmony": "^0.77.17" // ohpm 在线版本 // "@rnoh/react-native-openharmony" : "./react_native_openharmony.har" // 指向本地 har 包的路径 // "@rnoh/react-native-openharmony" : "./react_native_openharmony" // 指向源码路径 } @@ -304,7 +304,49 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { } ``` -### 2.5 运行 +### 2.5 配置TurboModule运行在worker线程 + +打开 `entry/src/main/ets/entryability/EntryAbility.ets`,添加: + +```diff +import {RNAbility} from '@rnoh/react-native-openharmony'; + +export default class EntryAbility extends RNAbility { ++ override getRNOHWorkerScriptUrl() { ++ return "entry/ets/workers/RNOHWorker.ets" ++ } +... +} +``` + +在ets路径下右击,选择 `New` 选项,右侧展开菜单选择 `Woker` 选项: + + ![create_worker](../img/react-native-background-timer/create-worker.png) + 选择后在弹出的窗口中取名 `RNOHWorker.ets`: + + ![christen_RNOHWorker](../img/react-native-background-timer/christen-RNOHWorker.png) + 此时目录结构为: + ``` + └── ets + ├── entryability + ├── page + └── workers + └── RNOHWorker.ets + ``` + 修改 `RNOHWorker.ets` 为下列代码: + ```typescript + // entry/src/main/ets/worker/RNOHWorker.ets + import { setupRNOHWorker } from "@rnoh/react-native-openharmony/src/main/ets/setupRNOHWorker"; + import { createRNPackages } from '../RNPackagesFactory'; + + setupRNOHWorker({ + createWorkerRNInstanceConfig: (_rnInstanceName) => { + return { thirdPartyPackagesFactory: createRNPackages } + } + }) + ``` + +### 2.6 运行 点击右上角的 `sync` 按钮 @@ -324,7 +366,7 @@ ohpm install 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-ohos/react-native-background-timer Releases](https://gitee.com/openharmony-sig/rntpc_react-native-background-timer/releases) +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-ohos/react-native-background-timer Releases](https://GitCode.com/openharmony-sig/rntpc_react-native-background-timer/releases) 本文档内容基于以下版本验证通过: @@ -352,12 +394,12 @@ RNOH: 0.72.38; SDK: HarmonyOS-5.0.0(API12); ROM: 5.0.0.107; ## 5. 遗留问题 -- [ ] 使用worker开的新线程中不支持RNOHContext序列化传参,底层OS暂不支持,导致无法在新线程中发送事件,需要底层OS框架实现相关业务功能。不开线程的情况下,因setTimeout属于异步方法,定时器效果不受影响。[worker线程遗留问题:start和stop接口, HarmonyOS RN框架暂不支持](https://gitee.com/openharmony-sig/rntpc_react-native-background-timer/issues/IB8QGJ) +- [ ] 使用worker开的新线程中不支持RNOHContext序列化传参,底层OS暂不支持,导致无法在新线程中发送事件,需要底层OS框架实现相关业务功能。不开线程的情况下,因setTimeout属于异步方法,定时器效果不受影响。[worker线程遗留问题:start和stop接口, HarmonyOS RN框架暂不支持](https://gitcode.com/openharmony-sig/rntpc_react-native-background-timer/issues/2) ## 6. 其他 ## 7. 开源协议 -本项目基于 [The MIT License (MIT)](https://gitee.com/openharmony-sig/rntpc_react-native-background-timer/blob/master/LICENSE) ,请自由地享受和参与开源。 +本项目基于 [The MIT License (MIT)](https://GitCode.com/openharmony-sig/rntpc_react-native-background-timer/blob/master/LICENSE) ,请自由地享受和参与开源。 diff --git a/zh-cn/react-native-barcode-builder.md b/zh-cn/react-native-barcode-builder.md index 2a92dd46d9360cb91f84594f6b4725942dcb5d64..d2fcc5356fba947bc2e78ca9aafaf0bb803f539c 100644 --- a/zh-cn/react-native-barcode-builder.md +++ b/zh-cn/react-native-barcode-builder.md @@ -16,7 +16,14 @@ ## 安装与使用 -1、请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-barcode-builder](https://github.com/react-native-oh-library/react-native-barcode-builder/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +请到三方库的 Releases 发布地址查看配套的版本信息: + +| 三方库版本 | 发布信息 | 支持RN0.77 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 2.0.0 | [@react-native-oh-tpl/react-native-barcode-builder](https://github.com/react-native-oh-library/react-native-barcode-builder/releases) | 0.72 | +| 2.0.1 | [@react-native-ohos/react-native-barcode-builder](https://gitcode.com/openharmony-sig/rntpc_react-native-barcode-builder) | 0.77 | + +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 进入到工程目录并输入以下命令: @@ -25,13 +32,21 @@ #### **npm** ```bash +# V2.0.0 npm install @react-native-oh-tpl/react-native-barcode-builder + +# V2.0.1 +npm install @react-native-ohos/react-native-barcode-builder ``` #### **yarn** ```bash +# V2.0.0 yarn add @react-native-oh-tpl/react-native-barcode-builder + +# V2.0.1 +yarn add @react-native-ohos/react-native-barcode-builder ``` @@ -74,9 +89,9 @@ export const BarcodeBuilderExample = () => { ## Link -本库鸿蒙侧实现依赖@react-native-oh-tpl/react-native-svg 的原生端代码,如已在鸿蒙工程中引入过该库,则无需再次引入,可跳过本章节步骤,直接使用。 +本库鸿蒙侧实现依赖@react-native-ohos/react-native-svg 的原生端代码,如已在鸿蒙工程中引入过该库,则无需再次引入,可跳过本章节步骤,直接使用。 -如未引入请参照[@react-native-oh-tpl/react-native-svg 文档](/zh-cn/react-native-svg-capi.md)进行引入 +如未引入请参照[@react-native-ohos/react-native-svg 文档](/zh-cn/react-native-svg-capi.md)进行引入 ## 约束与限制 @@ -84,7 +99,12 @@ export const BarcodeBuilderExample = () => { 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/react-native-barcode-builder](https://github.com/react-native-oh-library/react-native-barcode-builder) +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: + +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 2.0.0 | [@react-native-oh-tpl/react-native-barcode-builder](https://github.com/react-native-oh-library/react-native-barcode-builder) | 0.72 | +| 2.0.1 | [@react-native-ohos/react-native-barcode-builder](https://gitcode.com/openharmony-sig/rntpc_react-native-barcode-builder) | 0.77 | ## 属性 diff --git a/zh-cn/react-native-bouncy-checkbox.md b/zh-cn/react-native-bouncy-checkbox.md index 688ddac3752679c5527f8031bd421aacdbf43ed9..9b91af7cd633c7dc621f7d2675a9b601ee3ef419 100644 --- a/zh-cn/react-native-bouncy-checkbox.md +++ b/zh-cn/react-native-bouncy-checkbox.md @@ -27,13 +27,19 @@ #### **npm** ```bash +#0.72 npm install --save react-native-bouncy-checkbox@4.0.1 +#0.77 +npm install --save react-native-bouncy-checkbox@4.1.2 ``` #### **yarn** ```bash -yarn install --save react-native-bouncy-checkbox@4.0.1 +#0.72 +yarn add react-native-bouncy-checkbox@4.0.1 +#0.77 +yarn add react-native-bouncy-checkbox@4.1.2 ``` 下面的代码展示了这个库的基本使用场景: @@ -109,32 +115,33 @@ const styles = StyleSheet.create({ > [!TIP] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。 -| Name | Description | Type | Required | Platform | HarmonyOS Support | -| :------------------- | ------------------------------------------------------------ | --------- | -------- | -------- | ----------------- | -| isChecked | if you want to control check state yourself, you can use `isChecked` prop now! | boolean | no | All | yes | -| onPress | set your own onPress functionality after the bounce effect, callback receives the next `isChecked` boolean if disableBuiltInState is false | function | no | All | yes | -| onLongPress | set your own onLongPress functionality after the bounce effect, callback receives the next `isChecked` boolean if disableBuiltInState is false | function | no | All | yes | -| text | set the checkbox's text | string | no | All | yes | -| textComponent | set the checkbox's text by a React Component | component | no | All | yes | -| disableText | if you want to use checkbox without text, you can enable it | boolean | no | All | yes | -| size | size of `width` and `height` of the checkbox | number | no | All | yes | -| style | set/override the container style | style | no | All | yes | -| textStyle | set/override the text style | style | no | All | yes | -| iconStyle | set/override the outer icon container style | style | no | All | yes | -| innerIconStyle | set/override the inner icon container style | style | no | All | yes | -| fillColor | change the checkbox's filled color | color | no | All | yes | -| unfillColor | change the checkbox's un-filled color when it's not checked | color | no | All | yes | -| iconComponent | set your own icon component | component | no | All | yes | -| checkIconImageSource | set your own check icon image | image | no | All | yes | -| textContainerStyle | set/override the text container style | ViewStyle | no | All | yes | -| ImageComponent | set your own Image component instead of RN's default Image | component | no | All | yes | -| TouchableComponent | set/override the main TouchableOpacity component with any Touchable Component like Pressable | component | no | All | yes | -| bounceEffectIn | change the bounce effect when press in | number | no | All | yes | -| bounceEffectOut | change the bounce effect when press out | number | no | All | yes | -| bounceVelocityIn | change the bounce velocity when press in | number | no | All | yes | -| bounceVelocityOut | change the bounce velocity when press out | number | no | All | yes | -| bouncinessIn | change the bounciness when press in | number | no | All | yes | -| bouncinessOut | change the bounciness when press out | number | no | All | yes | +| Name | Description | Type | Required | Platform | HarmonyOS Support | +| :---------------------------------------------- | ------------------------------------------------------------ | --------- | -------- | -------- | ----------------- | +| isChecked | if you want to control check state yourself, you can use `isChecked` prop now! | boolean | no | All | yes | +| onPress | set your own onPress functionality after the bounce effect, callback receives the next `isChecked` boolean if disableBuiltInState is false | function | no | All | yes | +| onLongPress | set your own onLongPress functionality after the bounce effect, callback receives the next `isChecked` boolean if disableBuiltInState is false | function | no | All | yes | +| text | set the checkbox's text | string | no | All | yes | +| textComponent | set the checkbox's text by a React Component | component | no | All | yes | +| disableText | if you want to use checkbox without text, you can enable it | boolean | no | All | yes | +| useBuiltInStatedeprecated form 4.1.2 | to fully control the checkbox itself outside with your own state, just set to `false` and send your state value to `isChecked` prop | boolean | no | All | yes | +| size | size of `width` and `height` of the checkbox | number | no | All | yes | +| style | set/override the container style | style | no | All | yes | +| textStyle | set/override the text style | style | no | All | yes | +| iconStyle | set/override the outer icon container style | style | no | All | yes | +| innerIconStyle | set/override the inner icon container style | style | no | All | yes | +| fillColor | change the checkbox's filled color | color | no | All | yes | +| unfillColor | change the checkbox's un-filled color when it's not checked | color | no | All | yes | +| iconComponent | set your own icon component | component | no | All | yes | +| checkIconImageSource | set your own check icon image | image | no | All | yes | +| textContainerStyle | set/override the text container style | ViewStyle | no | All | yes | +| ImageComponent | set your own Image component instead of RN's default Image | component | no | All | yes | +| TouchableComponent | set/override the main TouchableOpacity component with any Touchable Component like Pressable | component | no | All | yes | +| bounceEffectIn | change the bounce effect when press in | number | no | All | yes | +| bounceEffectOut | change the bounce effect when press out | number | no | All | yes | +| bounceVelocityIn | change the bounce velocity when press in | number | no | All | yes | +| bounceVelocityOut | change the bounce velocity when press out | number | no | All | yes | +| bouncinessIn | change the bounciness when press in | number | no | All | yes | +| bouncinessOut | change the bounciness when press out | number | no | All | yes | ### diff --git a/zh-cn/react-native-clippath-capi.md b/zh-cn/react-native-clippath-capi.md index 3ef7e92cdf811686ec3cd36b86081bb2ad208439..bbf8a44605b403cad8b549df53577258d9a07a48 100644 --- a/zh-cn/react-native-clippath-capi.md +++ b/zh-cn/react-native-clippath-capi.md @@ -16,7 +16,14 @@ ## 安装与使用 -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-clippathview Releases](https://github.com/react-native-oh-library/react-native-clippath/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +请到三方库的 Releases 发布地址查看配套的版本信息: + +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 1.1.8 | [@react-native-oh-tpl/react-native-clippathview Releases](https://github.com/react-native-oh-library/react-native-clippath/releases) | 0.72 | +| 1.1.9 | [@react-native-ohos/react-native-clippathview Releases]() | 0.77 | + +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 进入到工程目录并输入以下命令: @@ -25,13 +32,21 @@ #### **npm** ```bash +#1.1.8 npm install @react-native-oh-tpl/react-native-clippathview + +#1.1.9 +npm install @react-native-ohos/react-native-clippathview ``` #### **yarn** ```bash +#1.1.8 yarn add @react-native-oh-tpl/react-native-clippathview + +#1.1.9 +yarn add @react-native-ohos/react-native-clippathview ``` @@ -91,6 +106,8 @@ export default function index() { 打开 `entry/oh-package.json5`,添加以下依赖 +- V1.1.8 + ```json "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", @@ -98,6 +115,15 @@ export default function index() { } ``` +- V1.1.9 + +```json +"dependencies": { + "@rnoh/react-native-openharmony": "file:../react_native_openharmony", + "@react-native-ohos/react-native-clippathview": "file:../../node_modules/@react-native-ohos/react-native-clippathview/harmony/clipPath.har", +} +``` + 点击右上角的 `sync` 按钮 或者在终端执行: @@ -127,7 +153,12 @@ add_subdirectory("${RNOH_CPP_DIR}" ./rn) # RNOH_END: manual_package_linking_1 add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) +#1.1.8 + add_subdirectory("${OH_MODULES}/@react-native-oh-tpl/react-native-clippathview/src/main/cpp" ./clippath) + +#1.1.9 ++ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-clippathview/src/main/cpp" ./clippath) + # RNOH_END: manual_package_linking_1 add_library(rnoh_app SHARED @@ -166,7 +197,10 @@ std::vector> PackageProvider::getPackages(Package::Cont ```diff ... + //1.1.8 + import { ClipPathPackage } from '@react-native-oh-tpl/react-native-clippathview/ts'; + //1.1.9 ++ import { ClipPathPackage } from '@react-native-ohos/react-native-clippathview/ts'; export function createRNPackages(ctx: RNPackageContext): RNPackage[] { return [ @@ -195,7 +229,12 @@ ohpm install 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/react-native-clippathview Releases](https://github.com/react-native-oh-library/react-native-clippath/releases) +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: + +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 1.1.8 | [@react-native-oh-tpl/react-native-clippathview Releases](https://github.com/react-native-oh-library/react-native-clippath/releases) | 0.72 | +| 1.1.9 | [@react-native-ohos/react-native-clippathview Releases]() | 0.77 | ## 属性 diff --git a/zh-cn/react-native-community-toolbar-android.md b/zh-cn/react-native-community-toolbar-android.md index 698c930a7c8eb776fe68e943437ee54f5110cf18..f68c9da9cb08745a295bab2b0fff839f5e3f542e 100644 --- a/zh-cn/react-native-community-toolbar-android.md +++ b/zh-cn/react-native-community-toolbar-android.md @@ -8,10 +8,14 @@ 该第三方库的仓库已迁移至 Gitee,且支持直接从 npm 下载,新的包名为:`@react-native-ohos/toolbar-android`,具体版本所属关系如下: -| Version | Package Name | Repository | Release | -|-----------------| ------------------------------------------------- | ------------------ | -------------------------- | -| <= 0.2.1-0.0.4 | @react-native-oh-tpl/toolbar-android | [Github(deprecated)](https://github.com/react-native-oh-library/toolbar-android) | [Github Releases(deprecated)](https://github.com/react-native-oh-library/toolbar-android/releases) | -| >= 0.2.2 | @react-native-ohos/toolbar-android | [Gitee](https://gitee.com/openharmony-sig/rntpc_toolbar-android) | [Gitee Releases](https://gitee.com/openharmony-sig/rntpc_toolbar-android/releases) | +| Version | Package Name | Repository | Release | Version for RN | +| ------------------------- | ------------------------------------------------- | ------------------ | -------------------------- | ------------------------- | +|<= 0.2.1-0.0.4 | @react-native-oh-tpl/toolbar-android | [Github(deprecated)](https://github.com/react-native-oh-library/toolbar-android) | [Github Releases(deprecated)](https://github.com/react-native-oh-library/toolbar-android/releases) | 0.72 | +| >= 0.2.2 | @react-native-ohos/toolbar-android | [Gitee](https://gitee.com/openharmony-sig/rntpc_toolbar-android) | [Gitee Releases](https://gitee.com/openharmony-sig/rntpc_toolbar-android/releases) | 0.72 | +| >= 0.2.2 | @react-native-ohos/toolbar-android | [Gitee](https://gitee.com/openharmony-sig/rntpc_toolbar-android) | [Gitee Releases](https://gitee.com/openharmony-sig/rntpc_toolbar-android/releases) | 0.77 | + + + ## 1.安装与使用 @@ -22,12 +26,20 @@ #### npm ```bash +# <= V0.2.1-0.0.4 +npm install @react-native-oh-tpl/toolbar-android + +# >= 0.2.2 npm install @react-native-ohos/toolbar-android ``` #### yarn ```bash +# <= V0.2.1-0.0.4 +yarn add @react-native-oh-tpl/toolbar-android + +# >= 0.2.2 yarn add @react-native-ohos/toolbar-android ``` @@ -149,7 +161,14 @@ export default App; > [!TIP] har 包位于三方库安装路径的 `harmony` 文件夹下。 打开 `entry/oh-package.json5`,添加以下依赖 +- <= V0.2.1-0.0.4 +```json +"dependencies": { + "@react-native-oh-tpl/toolbar-android": "file:../../node_modules/@react-native-oh-tpl/toolbar-android/harmony/toolbar_android.har" + } +``` +- \>= 0.2.2 ```json "dependencies": { "@react-native-ohos/toolbar-android": "file:../../node_modules/@react-native-ohos/toolbar-android/harmony/toolbar_android.har" @@ -189,6 +208,11 @@ add_compile_definitions(WITH_HITRACE_SYSTRACE) # RNOH_BEGIN: manual_package_linking_1 add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) + +#<= V0.2.1-0.0.4 ++ add_subdirectory("${OH_MODULES}/@react-native-oh-tpl/toolbar-android/src/main/cpp" ./toolbar-android) + +# >= 0.2.2 + add_subdirectory("${OH_MODULES}/@react-native-ohos/toolbar-android/src/main/cpp" ./toolbar-android) # RNOH_END: manual_package_linking_1 @@ -226,7 +250,21 @@ std::vector> PackageProvider::getPackages(Package::Cont > [!TIP] 版本 v0.2.22 及以上需要 打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: +- <= V0.2.1-0.0.4 +```diff + ... ++ import {ToolbarAndroidPackage} from '@react-native-oh-tpl/toolbar-android/src/main/ets/ToolbarAndroidPackage'; + +export function createRNPackages(ctx: RNPackageContext): RNPackage[] { + return [ ++ return [new ToolbarAndroidPackage(ctx)]; + ]; +} +``` + + +- \>= 0.2.2 ```diff ... + import {ToolbarAndroidPackage} from '@react-native-ohos/toolbar-android/src/main/ets/ToolbarAndroidPackage'; @@ -242,7 +280,27 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { ### 2.5.在 ArkTs 侧引入 RNCToolbarAndroid 组件 找到 **function buildCustomRNComponent()**,一般位于 `entry/src/main/ets/pages/index.ets` 或 `entry/src/main/ets/rn/LoadBundle.ets`,添加: +- <= V0.2.1-0.0.4 +```diff + ... ++ import { RNCToolbarAndroid} from '@react-native-oh-tpl/toolbar-android/src/main/ets/RNCToolbarAndroid' + + @Builder + function buildCustomRNComponent(ctx: ComponentBuilderContext) { + ... ++ if (ctx.componentName === RNCToolbarAndroid.NAME) { ++ RNCToolbarAndroid({ ++ ctx: ctx.rnComponentContext, ++ tag: ctx.tag ++ }) ++ } + ... + } + ... +``` + +- \>= 0.2.2 ```diff ... + import { RNCToolbarAndroid} from '@react-native-ohos/toolbar-android/src/main/ets/RNCToolbarAndroid' @@ -291,7 +349,12 @@ ohpm install 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-ohos/toolbar-android Releases](https://gitee.com/openharmony-sig/rntpc_toolbar-android/releases) +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: +| Version | Package Name | Repository | Release | Version for RN | +| ------------------------- | ------------------------------------------------- | ------------------ | -------------------------- | ------------------------- | +|<= 0.2.1-0.0.4 | @react-native-oh-tpl/toolbar-android | [Github(deprecated)](https://github.com/react-native-oh-library/toolbar-android) | [Github Releases(deprecated)](https://github.com/react-native-oh-library/toolbar-android/releases) | 0.72 | +| >= 0.2.2 | @react-native-ohos/toolbar-android | [Gitee](https://gitee.com/openharmony-sig/rntpc_toolbar-android) | [Gitee Releases](https://gitee.com/openharmony-sig/rntpc_toolbar-android/releases) | 0.72 | +| >= 0.2.2 | @react-native-ohos/toolbar-android | [Gitee](https://gitee.com/openharmony-sig/rntpc_toolbar-android) | [Gitee Releases](https://gitee.com/openharmony-sig/rntpc_toolbar-android/releases) | 0.77 | ## 4.属性 diff --git a/zh-cn/react-native-country-picker-modal.md b/zh-cn/react-native-country-picker-modal.md index 03ab96ed91f454cdb624b41f349bfed8898d8e6d..bf58f03a787d82f0477ba9bcaa27d73a43863ccb 100644 --- a/zh-cn/react-native-country-picker-modal.md +++ b/zh-cn/react-native-country-picker-modal.md @@ -16,7 +16,13 @@ ## 安装与使用 -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-library/react-native-country-picker-modal Releases](https://github.com/react-native-oh-library/react-native-country-picker-modal/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 2.0.0 | [@react-native-oh-tpl/react-native-country-picker-modal Releases](https://github.com/react-native-oh-library/react-native-country-picker-modal/releases) | 0.72 | +| 2.0.1 | [@react-native-ohos/react-native-country-picker-modal Releases]() | 0.77 | + +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 进入到工程目录并输入以下命令: @@ -27,13 +33,19 @@ #### **npm** ```bash +# 2.0.0 npm install @react-native-oh-tpl/react-native-country-picker-modal +# 2.0.1 +npm install @react-native-ohos/react-native-country-picker-modal ``` #### **yarn** ```bash +# 2.0.0 yarn add @react-native-oh-tpl/react-native-country-picker-modal +# 2.0.1 +yarn add @react-native-ohos/react-native-country-picker-modal ``` diff --git a/zh-cn/react-native-idfa-aaid.md b/zh-cn/react-native-idfa-aaid.md index 7b1ccd0536313bc61825f30c80a463ed97d1b811..58889090d5b14ca753af052162ef5fe9eeee91f3 100644 --- a/zh-cn/react-native-idfa-aaid.md +++ b/zh-cn/react-native-idfa-aaid.md @@ -16,8 +16,14 @@ ## 安装与使用 -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-library/react-native-idfa-aaid Releases](https://github.com/react-native-oh-library/react-native-idfa-aaid/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +请到三方库的 Releases 发布地址查看配套的版本信息: +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 1.2.0 | [@react-native-oh-tpl/react-native-idfa-aaid Releases](https://github.com/react-native-oh-library/react-native-idfa-aaid/releases) | 0.72 | +| 1.2.1 | [@react-native-ohos/react-native-idfa-aaid Releases]() | 0.77 | + +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 进入到工程目录并输入以下命令: @@ -25,13 +31,19 @@ #### npm ```bash +# 1.2.0 npm install @react-native-oh-tpl/react-native-idfa-aaid +# 1.2.1 +npm install @react-native-ohos/react-native-idfa-aaid ``` #### yarn ```bash +# 1.2.0 yarn add @react-native-oh-tpl/react-native-idfa-aaid +# 1.2.1 +yarn add @react-native-ohos/react-native-idfa-aaid ``` @@ -170,6 +182,8 @@ export default App; ## 使用 Codegen +> [!TIP] V1.2.1 不需要执行 Codegen。 + 本库已经适配了 `Codegen` ,在使用前需要主动执行生成三方库桥接代码,详细请参考[ Codegen 使用文档](/zh-cn/codegen.md)。 ## Link @@ -201,13 +215,20 @@ export default App; > [!TIP] har 包位于三方库安装路径的 `harmony` 文件夹下。 打开 `entry/oh-package.json5`,添加以下依赖 - +- V1.2.0 ```json "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", "@react-native-oh-tpl/react-native-idfa-aaid": "file:../../node_modules/@react-native-oh-tpl/react-native-idfa-aaid/harmony/getOaid.har" } ``` +- V1.2.1 +```json +"dependencies": { + "@rnoh/react-native-openharmony": "file:../react_native_openharmony", + "@react-native-ohos/react-native-idfa-aaid": "file:../../node_modules/@react-native-ohos/react-native-idfa-aaid/harmony/getOaid.har" + } +``` 点击右上角的 `sync` 按钮 @@ -229,8 +250,10 @@ ohpm install ```diff ... - + // V1.2.0 + import { GetOaidPackage } from "@react-native-oh-tpl/react-native-idfa-aaid/ts"; + // V1.2.1 ++ import { GetOaidPackage } from "@react-native-ohos/react-native-idfa-aaid/ts"; export function createRNPackages(ctx: RNPackageContext): RNPackage[] { return [ @@ -239,7 +262,69 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { ]; } ``` -### 4.运行 +### 4.配置 CMakeLists 和引入 IdfaAaidPackage + +> [!TIP] V4.4.2 需要执行 + +打开 `entry/src/main/cpp/CMakeLists.txt`,添加: + +```diff +project(rnapp) +cmake_minimum_required(VERSION 3.4.1) +set(CMAKE_SKIP_BUILD_RPATH TRUE) +set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}") +set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules") ++ set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules") +set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp") +set(LOG_VERBOSITY_LEVEL 1) +set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments") +set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie") +set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use +add_compile_definitions(WITH_HITRACE_SYSTRACE) + +add_subdirectory("${RNOH_CPP_DIR}" ./rn) + +# RNOH_BEGIN: manual_package_linking_1 +add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) ++ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-idfa-aaid/src/main/cpp" ./idfa-aaid) + +# 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_getOaid) +# 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 "IdfaAaidPackage.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 +342,14 @@ ohpm install ### 兼容性 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-library/react-native-idfa-aaid Releases](https://github.com/react-native-oh-library/react-native-idfa-aaid/releases) +请到三方库的 Releases 发布地址查看配套的版本信息: + +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 1.2.0 | [@react-native-oh-tpl/react-native-idfa-aaid Releases](https://github.com/react-native-oh-library/react-native-idfa-aaid/releases) | 0.72 | +| 1.2.1 | [@react-native-ohos/react-native-idfa-aaid Releases]() | 0.77 | + +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 ### 权限要求 diff --git a/zh-cn/react-native-image-sequence-2.md b/zh-cn/react-native-image-sequence-2.md index f1990f0fc898fd481161534e37861dc9e7a8f850..eb48329226706aa8c576cec14922329a23ad4961 100644 --- a/zh-cn/react-native-image-sequence-2.md +++ b/zh-cn/react-native-image-sequence-2.md @@ -9,10 +9,11 @@ 该第三方库的仓库已迁移至 Gitee,且支持直接从 npm 下载,新的包名为:`@react-native-ohos/react-native-image-sequence`,具体版本所属关系如下: -| Version | Package Name | Repository | Release | -| ------------------------------ | ---------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| <= 0.9.1@deprecated | @react-native-oh-library/react-native-image-sequence | [Github(deprecated)](https://github.com/react-native-oh-library/react-native-image-sequence) | [Github Releases(deprecated)](https://github.com/react-native-oh-library/react-native-image-sequence/releases) | -| > 0.9.1 | @react-native-ohos/react-native-image-sequence | [Gitcode](https://gitcode.com/openharmony-sig/rntpc_react-native-image-sequence) | [Gitee Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-image-sequence/releases) | +| Version | Package Name | Repository | Release | 支持RN版本 | +| ------------------------------ | ---------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------ | +| <= 0.9.1@deprecated | @react-native-oh-library/react-native-image-sequence | [Github(deprecated)](https://github.com/react-native-oh-library/react-native-image-sequence) | [Github Releases(deprecated)](https://github.com/react-native-oh-library/react-native-image-sequence/releases) | 0.72 | +| > 0.9.1 | @react-native-ohos/react-native-image-sequence | [Gitcode](https://gitcode.com/openharmony-sig/rntpc_react-native-image-sequence) | [Gitee Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-image-sequence/releases) | 0.77 | +| > 0.9.1 | @react-native-ohos/react-native-image-sequence | [Gitcode](https://gitcode.com/openharmony-sig/rntpc_react-native-image-sequence) | [Gitee Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-image-sequence/releases) | 0.77 | ## 安装与使用 @@ -394,7 +395,7 @@ export function buildCustomRNComponent(ctx: ComponentBuilderContext) { ```diff ... -+ import { ImageSequencePackage } from "@react-native-oh-tpl/react-native-image-sequence-2/ts"; ++ import { ImageSequencePackage } from "@react-native-ohos/react-native-image-sequence-2/ts"; export function createRNPackages(ctx: RNPackageContext): RNPackage[] { return [ @@ -421,7 +422,13 @@ ohpm install ### 3.1 兼容性 -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-ohos/react-native-image-sequence Releases](https://gitee.com/openharmony-sig/rntpc_react-native-image-sequence/releases) +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: + +| Version | Package Name | Repository | Release | 支持RN版本 | +| ------------------- | ---------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ---------- | +| <= 0.9.1@deprecated | @react-native-oh-library/react-native-image-sequence | [Github(deprecated)](https://github.com/react-native-oh-library/react-native-image-sequence) | [Github Releases(deprecated)](https://github.com/react-native-oh-library/react-native-image-sequence/releases) | 0.72 | +| > 0.9.1 | @react-native-ohos/react-native-image-sequence | [Gitcode](https://gitcode.com/openharmony-sig/rntpc_react-native-image-sequence) | [Gitee Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-image-sequence/releases) | 0.77 | +| > 0.9.1 | @react-native-ohos/react-native-image-sequence | [Gitcode](https://gitcode.com/openharmony-sig/rntpc_react-native-image-sequence) | [Gitee Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-image-sequence/releases) | 0.77 | ## 4. 属性 diff --git a/zh-cn/react-native-intersection-observer.md b/zh-cn/react-native-intersection-observer.md index 8b2f03d015e6212a2b243893f673466e86969c3b..9bfb44c7e4c8f7f90f7235d29317a0b74b789cf1 100644 --- a/zh-cn/react-native-intersection-observer.md +++ b/zh-cn/react-native-intersection-observer.md @@ -18,7 +18,14 @@ ## 安装与使用 -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-intersection-observer Releases](https://github.com/react-native-oh-library/react-native-intersection-observer/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +请到三方库的 Releases 发布地址查看配套的版本信息: + +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 2.0.0 | [@react-native-oh-tpl/react-native-intersection-observer Releases](https://github.com/react-native-oh-library/react-native-intersection-observer/releases) | 0.72 | +| 2.0.1 | [@react-native-ohos/react-native-intersection-observer Releases]() | 0.77 | + + 进入到工程目录并输入以下命令: @@ -27,13 +34,21 @@ #### **npm** ```bash +# V2.0.0 npm install @react-native-oh-tpl/react-native-intersection-observer + +# V2.0.1 +npm install @react-native-ohos/react-native-intersection-observer ``` #### **yarn** ```bash +# V2.0.0 yarn add @react-native-oh-tpl/react-native-intersection-observer + +# V2.0.1 +yarn add @react-native-ohos/react-native-intersection-observer ``` @@ -77,11 +92,12 @@ export default App; ## 约束与限制 #### 兼容性 +请到三方库的 Releases 发布地址查看配套的版本信息: -在下述版本验证通过: - -1. RNOH:0.72.20; SDK:HarmonyOS NEXT Developer Preview2; IDE:DevEco Studio 5.0.3.200; ROM:205.0.0.18; -2. RNOH:0.72.33; SDK:OpenHarmony 5.0.0.71(API Version 12 Release); IDE:DevEco Studio 5.0.3.900; ROM:NEXT.0.0.71; +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 2.0.0 | [@react-native-oh-tpl/react-native-intersection-observer Releases](https://github.com/react-native-oh-library/react-native-intersection-observer/releases) | 0.72 | +| 2.0.1 | [@react-native-ohos/react-native-intersection-observer Releases]() | 0.77 | ## 属性 diff --git a/zh-cn/react-native-material-dropdown.md b/zh-cn/react-native-material-dropdown.md index 3db308f7a326208b183db579557cc986663bc791..2acfb621f41745ef71e2d745d5142c1059d2c3d1 100644 --- a/zh-cn/react-native-material-dropdown.md +++ b/zh-cn/react-native-material-dropdown.md @@ -19,13 +19,16 @@ > [!TIP] [Github 地址](https://github.com/react-native-oh-library/react-native-material-dropdown) ## 安装与使用 +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 0.11.1 |[@react-native-oh-tpl/react-native-material-dropdown Releases](https://github.com/react-native-oh-library/react-native-material-dropdown/releases)| 0.72 | +| 0.11.2 |[@react-native-ohos/react-native-material-dropdown Releases]() | 0.77 | -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-material-dropdown Releases](https://github.com/react-native-oh-library/react-native-material-dropdown/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 - -> [!TIP] 本库依赖[@react-native-oh-tpl/react-native-material-textfield 文档](/zh-cn/react-native-material-textfield.md) - -和 [@react-native-oh-tpl/react-native-material-buttons 文档](/zh-cn/react-native-material-buttons.md) +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +> [!TIP] 本库依赖[@react-native-ohos/react-native-material-textfield 文档](/zh-cn/react-native-material-textfield.md) +和 [@react-native-ohos/react-native-material-buttons 文档](/zh-cn/react-native-material-buttons.md) 进入到工程目录并输入以下命令: @@ -34,13 +37,21 @@ #### **npm** ```bash +# V0.11.1 npm install @react-native-oh-tpl/react-native-material-dropdown + +# V0.11.2 +npm install @react-native-ohos/react-native-material-dropdown ``` #### **yarn** ```bash +# V0.11.1 yarn add @react-native-oh-tpl/react-native-material-dropdown + +# V0.11.2 +yarn add @react-native-ohos/react-native-material-dropdown ``` @@ -91,7 +102,13 @@ class Example extends Component { 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/react-native-material-dropdown Releases](https://github.com/react-native-oh-library/react-native-material-dropdown/releases) +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 0.11.1 |[@react-native-oh-tpl/react-native-material-dropdown Releases](https://github.com/react-native-oh-library/react-native-material-dropdown/releases)| 0.72 | +| 0.11.2 |[@react-native-ohos/react-native-material-dropdown Releases]() | 0.77 | + +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 ## 属性 diff --git a/zh-cn/react-native-picker-select.md b/zh-cn/react-native-picker-select.md index bef59199778b08b945b192650abe8ada218b5129..93f521f85e90bb020380dc7e60ad264ccc7e2798 100644 --- a/zh-cn/react-native-picker-select.md +++ b/zh-cn/react-native-picker-select.md @@ -16,7 +16,13 @@ ## 安装与使用 -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-picker-select Releases](https://github.com/react-native-oh-library/react-native-picker-select/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 9.3.1 | [@react-native-oh-tpl/react-native-picker-select Releases](https://github.com/react-native-oh-library/react-native-picker-select/releases) | 0.72 | +| 9.3.2 | [@react-native-ohos/react-native-picker-select Releases]() | 0.77 | + +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 进入到工程目录并输入以下命令: @@ -25,13 +31,19 @@ #### **npm** ```bash +# 9.3.1 npm install @react-native-oh-tpl/react-native-picker-select +# 9.3.2 +npm install @react-native-ohos/react-native-picker-select ``` #### **yarn** ```bash +# 9.3.1 yarn add @react-native-oh-tpl/react-native-picker-select +# 9.3.2 +yarn add @react-native-ohos/react-native-picker-select ``` @@ -191,7 +203,13 @@ const styles = StyleSheet.create({ 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/react-native-picker-select Releases](https://github.com/react-native-oh-library/react-native-picker-select/releases) +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 9.3.1 | [@react-native-oh-tpl/react-native-picker-select Releases](https://github.com/react-native-oh-library/react-native-picker-select/releases) | 0.72 | +| 9.3.2 | [@react-native-ohos/react-native-picker-select Releases]() | 0.77 | + +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 ## 属性 diff --git a/zh-cn/react-native-progress.md b/zh-cn/react-native-progress.md index 3019d118a6f18880b74c94fabddab24de722bfea..94942538d891dea69ba9f9bf7c3fb3f8e48b4ade 100644 --- a/zh-cn/react-native-progress.md +++ b/zh-cn/react-native-progress.md @@ -16,7 +16,12 @@ ## 安装与使用 -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-progress Releases](https://github.com/react-native-oh-library/react-native-progress/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 5.0.1 | [@react-native-oh-tpl/react-native-progress Releases](https://github.com/react-native-oh-library/react-native-progress/releases) | 0.72 | +| 5.0.2 | [@react-native-ohos/react-native-progress Releases]() | 0.77 | + 进入到工程目录并输入以下命令: @@ -25,13 +30,21 @@ #### **npm** ```bash +# V5.0.1 npm install @react-native-oh-tpl/react-native-progress + +# V5.0.2 +npm install @react-native-ohos/react-native-progress ``` #### **yarn** ```bash +# V5.0.1 yarn add @react-native-oh-tpl/react-native-progress + +# V5.0.2 +yarn add @react-native-ohos/react-native-progress ``` @@ -137,8 +150,11 @@ const styles = StyleSheet.create({ ### 兼容性 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 - -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/react-native-progress Releases](https://github.com/react-native-oh-library/react-native-progress/releases) +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 5.0.1 | [@react-native-oh-tpl/react-native-progress Releases](https://github.com/react-native-oh-library/react-native-progress/releases) | 0.72 | +| 5.0.2 | [@react-native-ohos/react-native-progress Releases]() | 0.77 | ## 属性 diff --git a/zh-cn/react-native-qr-decode-image-camera.md b/zh-cn/react-native-qr-decode-image-camera.md index 1ba1cc159d5a26143cee9937a3e6c852e9346a19..779cb38a43db208a28b595d7580abc69390801c1 100644 --- a/zh-cn/react-native-qr-decode-image-camera.md +++ b/zh-cn/react-native-qr-decode-image-camera.md @@ -17,7 +17,14 @@ ## 安装与使用 -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-qr-decode-image-camera Releases](https://github.com/react-native-oh-library/react-native-qr-decode-image-camera/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +请到三方库的 Releases 发布地址查看配套的版本信息: + +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 1.1.3 | [@react-native-oh-tpl/react-native-qr-decode-image-camera Releases](https://github.com/react-native-oh-library/react-native-qr-decode-image-camera/releases) | 0.72 | +| 1.1.4 | [@react-native-ohos/react-native-qr-decode-image-camera Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-qr-decode-image-camera) | 0.77 | + +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 进入到工程目录并输入以下命令: @@ -26,13 +33,19 @@ #### **npm** ```bash +# 1.1.3 npm install @react-native-oh-tpl/react-native-qr-decode-image-camera +# 1.1.4 +npm install @react-native-ohos/react-native-qr-decode-image-camera ``` #### **yarn** ```bash +# 1.1.3 yarn add @react-native-oh-tpl/react-native-qr-decode-image-camera +# 1.1.4 +yarn add @react-native-ohos/react-native-qr-decode-image-camera ``` @@ -140,6 +153,8 @@ const styles = StyleSheet.create({ ## 使用 Codegen +> [!TIP] V1.1.4 不需要执行 Codegen。 + 本库已经适配了 `Codegen` ,在使用前需要主动执行生成三方库桥接代码,详细请参考[ Codegen 使用文档](/zh-cn/codegen.md)。 ## Link @@ -172,6 +187,7 @@ const styles = StyleSheet.create({ 打开 `entry/oh-package.json5`,添加以下依赖 +- V1.1.3 ```json "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", @@ -179,6 +195,14 @@ const styles = StyleSheet.create({ } ``` +- V1.1.4 +```json +"dependencies": { + "@rnoh/react-native-openharmony": "file:../react_native_openharmony", + "@react-native-ohos/react-native-qr-decode-image-camera": "file:../../node_modules/@react-native-ohos/react-native-qr-decode-image-camera/harmony/qr_decode_image_camera.har" + } +``` + 点击右上角的 `sync` 按钮 或者在终端执行: @@ -199,7 +223,10 @@ ohpm install ```diff ... + // V1.1.3 + import {RNQrDecodeImageCameraPackage} from '@react-native-oh-tpl/react-native-qr-decode-image-camera/ts'; + // V1.1.4 ++ import {RNQrDecodeImageCameraPackage} from '@react-native-ohos/react-native-qr-decode-image-camera/ts'; export function createRNPackages(ctx: RNPackageContext): RNPackage[] { return [ @@ -215,7 +242,10 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { ```diff ... + // V1.1.3 + import { NativeScan } from "@react-native-oh-tpl/react-native-qr-decode-image-camera" + // V1.1.4 ++ import { NativeScan } from "@react-native-ohos/react-native-qr-decode-image-camera" @Builder export function buildCustomRNComponent(ctx: ComponentBuilderContext) { @@ -231,7 +261,69 @@ export function buildCustomRNComponent(ctx: ComponentBuilderContext) { ... ``` -### 5.运行 +### 5.配置 CMakeLists 和引入 QrDecodeImageCameraPackage + +> [!TIP] V1.1.4 需要执行 + +打开 `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-qr-decode-image-camera/src/main/cpp" ./qr-decode-image-camera) + +# 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_qr_decode_image_camera) +# 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 "QrDecodeImageCameraPackage.h" + +using namespace rnoh; + +std::vector> PackageProvider::getPackages(Package::Context ctx) { + return { + std::make_shared(ctx), + std::make_shared(ctx), ++ std::make_shared(ctx), + }; +} +``` + +### 6.运行 点击右上角的 `sync` 按钮 @@ -250,7 +342,14 @@ ohpm install 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/react-native-qr-decode-image-camera](https://github.com/react-native-oh-library/react-native-qr-decode-image-camera/releases) +请到三方库的 Releases 发布地址查看配套的版本信息: + +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 1.1.3 | [@react-native-oh-tpl/react-native-qr-decode-image-camera Releases](https://github.com/react-native-oh-library/react-native-qr-decode-image-camera/releases) | 0.72 | +| 1.1.4 | [@react-native-ohos/react-native-qr-decode-image-camera Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-qr-decode-image-camera) | 0.77 | + +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 ## 静态方法 diff --git a/zh-cn/react-native-tcp-socket.md b/zh-cn/react-native-tcp-socket.md index 0b63625cf5f3e28cd05f424947a80b1c62ccb399..20de6722808578daeda4ad5136a04f9183dd70ae 100644 --- a/zh-cn/react-native-tcp-socket.md +++ b/zh-cn/react-native-tcp-socket.md @@ -16,7 +16,14 @@ ## 安装与使用 -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-tcp-socket Releases](https://github.com/react-native-oh-library/react-native-tcp-socket/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +请到三方库的 Releases 发布地址查看配套的版本信息: + +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 6.2.0 | [@react-native-oh-tpl/react-native-tcp-socket Releases](https://github.com/react-native-oh-library/react-native-tcp-socket/releases) | 0.72 | +| 6.3.1 | [@react-native-ohos/react-native-tcp-socket Releases]() | 0.77 | + +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 进入到工程目录并输入以下命令: @@ -25,13 +32,21 @@ #### **npm** ```bash +# V6.2.0 npm install @react-native-oh-tpl/react-native-tcp-socket + +# V6.3.1 +npm install @react-native-ohos/react-native-tcp-socket ``` #### **yarn** ```bash +# V6.2.0 yarn add @react-native-oh-tpl/react-native-tcp-socket + +# V6.3.1 +yarn add @react-native-ohos/react-native-tcp-socket ``` @@ -567,6 +582,8 @@ const styles = StyleSheet.create({ ## 使用 Codegen +> [!TIP] V6.3.1 不需要执行Codegen + 本库已经适配了 `Codegen` ,在使用前需要主动执行生成三方库桥接代码,详细请参考[ Codegen 使用文档](/zh-cn/codegen.md)。 ## Link @@ -599,6 +616,8 @@ const styles = StyleSheet.create({ 打开 `entry/oh-package.json5`,添加以下依赖 +- V6.2.0 + ```json "dependencies": { "@rnoh/react-native-openharmony" : "file:../react_native_openharmony", @@ -606,6 +625,15 @@ const styles = StyleSheet.create({ } ``` +- V6.3.1 + +```JSON +"dependencies": { + "@rnoh/react-native-openharmony" : "file:../react_native_openharmony", + "@react-native-ohos/react-native-tcp-socket": "file:../../node_modules/@react-native-ohos/react-native-tcp-socket/harmony/tcp_socket.har" + } +``` + 点击右上角的 `sync` 按钮 或者在终端执行: @@ -619,14 +647,80 @@ ohpm install > [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](/zh-cn/link-source-code.md) -### 3.在 ArkTs 侧引入 TcpSocketPackage + +### 3.配置CMakeLists 和引入 TcpSocketPackage + +> [!TIP] 若使用的是 6.2.0 版本,请跳过本章 + +打开 `entry/src/main/cpp/CMakeLists.txt`,添加: + +```cmake +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-tcp-socket/src/main/cpp" ./tcp-socket) +# 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_tcp_socket) +# RNOH_END: manual_package_linking_2 +``` + +打开 `entry/src/main/cpp/PackageProvider.cpp`,添加: + +```c++ +#include "RNOH/PackageProvider.h" +#include "generated/RNOHGeneratedPackage.h" +#include "SamplePackage.h" ++ #include "TcpSocketPackage.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 侧引入 TcpSocketPackage 打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: ```diff ... +// v6.2.0 + import {TcpSocketPackage} from '@react-native-oh-tpl/react-native-tcp-socket/ts'; +// v6.3.1 ++ import {TcpSocketPackage} from '@react-native-ohos/react-native-tcp-socket/ts'; + export function createRNPackages(ctx: RNPackageContext): RNPackage[] { return [new SamplePackage(ctx), + new TcpSocketPackage(ctx) @@ -634,7 +728,7 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { } ``` -### 4.运行 +### 5.运行 点击右上角的 `sync` 按钮 @@ -679,20 +773,21 @@ ohpm install > [!TIP] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。 -| Name | Description | Type | Required | Platform | HarmonyOS Support | -| -------------------------------------------- | --------------------------------------------------- | -------- | -------- | ----------- | ----------------- | -| connect(options, callback) | Same as createConnection,Creating a TCP Socket | function | no | Android,iOS | yes | -| createServer(connectionListener) | Creating a TCP Server | function | no | Android,iOS | yes | -| createConnection(options, callback) | Creating a TCP Socket | function | no | Android,iOS | yes | -| createTLSServer(options, connectionListener) | Creating a TLS-based TCP Server | function | no | Android,iOS | yes | -| connectTLS | Creating a TLS-based encrypted connection | function | no | Android,iOS | yes | -| isIP | Check whether a character string is an IP address | function | no | Android,iOS | yes | -| isIPv4 | Check whether a character string is an IPv4 address | function | no | Android,iOS | yes | -| isIPv6 | Check whether a character string is an IPv6 address | function | no | Android,iOS | yes | -| Server | TCP Server Object | object | no | Android,iOS | yes | -| Socket | TCP Socket Object | object | no | Android,iOS | yes | -| TLSServer | TLS Server Object | object | no | Android,iOS | yes | -| TLSSocket | TLS Socket Object | object | no | Android,iOS | yes | +| Name | Description | Type | Required | Platform | HarmonyOS Support | +| ---------------------------------------------------------- | --------------------------------------------------- | -------- | -------- | ----------- | ----------------- | +| connect(options, callback) | Same as createConnection,Creating a TCP Socket | function | no | Android,iOS | yes | +| createServer(connectionListener) | Creating a TCP Server | function | no | Android,iOS | yes | +| createServer(options,connectionListener)6.3.1+ | Creating a TCP Server | function | no | Android,iOS | yes | +| createConnection(options, callback) | Creating a TCP Socket | function | no | Android,iOS | yes | +| createTLSServer(options, connectionListener) | Creating a TLS-based TCP Server | function | no | Android,iOS | yes | +| connectTLS | Creating a TLS-based encrypted connection | function | no | Android,iOS | yes | +| isIP | Check whether a character string is an IP address | function | no | Android,iOS | yes | +| isIPv4 | Check whether a character string is an IPv4 address | function | no | Android,iOS | yes | +| isIPv6 | Check whether a character string is an IPv6 address | function | no | Android,iOS | yes | +| Server | TCP Server Object | object | no | Android,iOS | yes | +| Socket | TCP Socket Object | object | no | Android,iOS | yes | +| TLSServer | TLS Server Object | object | no | Android,iOS | yes | +| TLSSocket | TLS Socket Object | object | no | Android,iOS | yes | ### Server diff --git a/zh-cn/react-native-thumbnail.md b/zh-cn/react-native-thumbnail.md index ba8c7a8195149ecf9adbc9e22cbfecaadfbf7842..414f797f8219973eb92b30c6581cb34a7b4fa552 100644 --- a/zh-cn/react-native-thumbnail.md +++ b/zh-cn/react-native-thumbnail.md @@ -13,9 +13,15 @@ > [!TIP] [Github 地址](https://github.com/react-native-oh-library/react-native-thumbnail) -## 安装与使用 +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 1.1.3 | [@react-native-oh-tpl/react-native-thumbnail Releases](https://github.com/react-native-oh-library/react-native-thumbnail/releases) | 0.72 | +| 1.1.4 | [@react-native-ohos/react-native-thumbnail Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-thumbnail) | 0.77 | -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-thumbnail Releases](https://github.com/react-native-oh-library/react-native-thumbnail/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 + +## 1. 安装与使用 进入到工程目录并输入以下命令: @@ -24,13 +30,21 @@ #### **npm** ```bash +# V1.1.3 npm install @react-native-oh-tpl/react-native-thumbnail + +# V1.1.4 +npm install @react-native-ohos/react-native-thumbnail ``` #### **yarn** ```bash +# V1.1.3 yarn add @react-native-oh-tpl/react-native-thumbnail + +# V1.1.4 +yarn add @react-native-ohos/react-native-thumbnail ``` @@ -38,7 +52,7 @@ yarn add @react-native-oh-tpl/react-native-thumbnail 下面的代码展示了这个库的基本使用场景: > [!WARNING] 使用时 import 的库名不变。
-> [!TIP] 本示例依赖 react-native-image-picker 库,参照[@react-native-oh-tpl/react-native-image-picker 文档](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/react-native-image-picker.md)进行引入。 +> [!TIP] 本示例依赖 react-native-image-picker 库,参照[@react-native-ohos/react-native-image-picker 文档](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/react-native-image-picker.md)进行引入。 ```js import React from 'react'; import { StyleSheet, Text, View, TouchableOpacity, Image } from 'react-native'; @@ -154,15 +168,19 @@ const styles = StyleSheet.create({ ## 使用 Codegen -本库已经适配了 `Codegen` ,在使用前需要主动执行生成三方库桥接代码,详细请参考[ Codegen 使用文档](/codegen.md)。 +[!TIP] V1.1.4 不需要执行 Codegen。 + +本库已经适配了 `Codegen` ,在使用前需要主动执行生成三方库桥接代码,详细请参考[ Codegen 使用文档](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/codegen.md)。 -## Link +## 2. Manual Link -目前 HarmonyOS 暂不支持 AutoLink,所以 Link 步骤需要手动配置。 +此步骤为手动配置原生依赖项的指导。 -首先需要使用 DevEco Studio 打开项目里的 HarmonyOS 工程 `harmony` +首先需要使用 DevEco Studio 打开项目里的 HarmonyOS 工程 `harmony`。 -### 在工程根目录的 `oh-package.json5` 添加 overrides 字段 +### 2.1. Overrides RN SDK + +为了让工程依赖同一个版本的 RN SDK,需要在工程根目录的 `oh-package.json5` 添加 overrides 字段,指向工程需要使用的 RN SDK 版本。替换的版本既可以是一个具体的版本号,也可以是一个模糊版本,还可以是本地存在的 HAR 包或源码目录。 ```json { @@ -173,7 +191,7 @@ const styles = StyleSheet.create({ } ``` -### 引入原生端代码 +### 2.2. 引入原生端代码 目前有两种方法: @@ -185,7 +203,7 @@ const styles = StyleSheet.create({ > [!TIP] har 包位于三方库安装路径的 `harmony` 文件夹下。 打开 `entry/oh-package.json5`,添加以下依赖 - +- V1.1.3 ```json "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", @@ -193,23 +211,70 @@ const styles = StyleSheet.create({ } ``` -点击右上角的 `sync` 按钮 +- V1.1.4 +```json +"dependencies": { + "@rnoh/react-native-openharmony": "file:../react_native_openharmony", + "@react-native-ohos/react-native-thumbnail": "file:../../node_modules/@react-native-ohos/react-native-thumbnail/harmony/thumbnail.har" + } +``` +### 2.3. 配置 CMakeLists 和引入 RNFSPackage -或者在终端执行: +> [!TIP] 版本 v1.1.4 及以上需要 -```bash -cd entry -ohpm install +打开 `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_BEGIN: manual_package_linking_1 +add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) + ++ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-thumbnail/src/main/cpp" ./thumbnail) + +# RNOH_END: manual_package_linking_1 + +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_thumbnail) +# RNOH_END: manual_package_linking_2 ``` -方法二:直接链接源码 +打开 `entry/src/main/cpp/PackageProvider.cpp`,添加: -> [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](/link-source-code.md) +```diff +#include "RNOH/PackageProvider.h" +#include "SamplePackage.h" ++ #include "ThumbnailPackage.h" -### 在 ArkTs 侧引入 RNThumbnailPackage +using namespace rnoh; -打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: +std::vector> PackageProvider::getPackages(Package::Context ctx) { + return { + std::make_shared(ctx), ++ std::make_shared(ctx) + }; +} +``` +### 2.4. 在 ArkTs 侧引入 FsPackage + +打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: +- V1.1.3 ```diff import { RNPackageContext, RNPackage } from '@rnoh/react-native-openharmony/ts'; +import { RNThumbnailPackage } from '@react-native-oh-tpl/react-native-thumbnail/ts'; @@ -220,8 +285,32 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { ]; } ``` +- V1.1.4 +```diff +import { RNPackageContext, RNPackage } from '@rnoh/react-native-openharmony/ts'; ++import { RNThumbnailPackage } from '@react-native-ohos/react-native-thumbnail/ts'; + +export function createRNPackages(ctx: RNPackageContext): RNPackage[] { + return [ ++ new RNThumbnailPackage(ctx), + ]; +} +``` + +点击右上角的 `sync` 按钮 + +或者在终端执行: + +```bash +cd entry +ohpm install +``` + +方法二:直接链接源码 + +> [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](/link-source-code.md) -### 运行 +### 2.5. 运行 点击右上角的 `sync` 按钮 @@ -234,15 +323,20 @@ ohpm install 然后编译、运行即可。 -## 约束与限制 +## 3. 约束与限制 -### 兼容性 +### 3.1. 兼容性 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息: +| 三方库版本 | 发布信息 | 支持RN版本 | +| ---------- | ------------------------------------------------------------ | ---------- | +| 1.1.3 | [@react-native-oh-tpl/react-native-thumbnail Releases](https://github.com/react-native-oh-library/react-native-thumbnail/releases) | 0.72 | +| 1.1.4 | [@react-native-ohos/react-native-thumbnail Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-thumbnail) | 0.77 | -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[react-native-thumbnail Releases](https://github.com/react-native-oh-library/react-native-thumbnail/releases) +对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 -## API +## 4. API > [!TIP] "Platform"列表示该属性在原三方库上支持的平台。 @@ -252,10 +346,10 @@ ohpm install | ---- | ----------- | ---- | -------- | -------- | ------------------ | | get | Generates a thumbnail for a video file. | function | no | All | yes | -## 遗留问题 +## 5. 遗留问题 -## 其他 +## 6. 其他 -## 开源协议 +## 7. 开源协议 本项目基于 [The MIT License (MIT)](https://github.com/phuochau/react-native-thumbnail/blob/master/LICENSE) ,请自由地享受和参与开源。