From 4e0b9260dedb5f4ce267ea288fd4afe178ffe6b1 Mon Sep 17 00:00:00 2001
From: Louis-C7
Date: Wed, 31 Jan 2024 17:24:05 +0800
Subject: [PATCH 1/3] =?UTF-8?q?[Issues:=20#I908Y7]=20=E6=9B=B4=E6=96=B0?=
=?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=88=B00130=E7=89=88=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
1224/model.md | 47 +++++++---
zh-cn/model.md | 246 ++++++++++++++++++++++++++-----------------------
2 files changed, 164 insertions(+), 129 deletions(-)
diff --git a/1224/model.md b/1224/model.md
index 3a5493e6..9f500255 100644
--- a/1224/model.md
+++ b/1224/model.md
@@ -1,8 +1,8 @@
# 文档模板(删除)
-> [!ATTENTION] 使用模板时请将后面带有 (删除) 的语句删除。(删除)
+> [!ATTENTION] 使用模板时请将后面带有 (删除) 的语句删除。<>内是需要修改的内容。(删除)
-> 模板版本:v0.1.2
+> 模板版本:v0.1.3
<原库 npm 包名>
@@ -19,28 +19,30 @@
> [!tip] [Github 地址](https://github.com/<源码仓地址>)
-如:[Github 地址](https://github.com/react-native-oh-library/react-native-linear-gradient)(删除)
+如:[Github 地址](https://github.com/react-native-oh-library/react-native-linear-gradient)(已建仓的地址,未建仓则使用原库地址)(删除)
## 安装与使用
进入到工程目录并输入以下命令:
-
+请到三方库的 Releases 发布地址查看配套的版本信息:[<@react-native-oh-tpl/库名> Releases](https://github.com/<仓库地址>/releases),并下载适用版本的 tgz 包。
-#### **yarn**
+进入到工程目录,打开 `package.json`,添加:
-```bash
-yarn add @react-native-oh-tpl/
-// 提示:yarn add @react-native-oh-tpl/flash-list(删除)
-// 提示:yarn add @react-native-oh-tpl/react-native-linear-gradient(删除)
+```json
+{
+ "dpendencies": {
+ ...
+ "@react-native-oh-tpl/<库名>": "tgz包路径"
+ },
+ ...
+}
```
-#### **npm**
+打开终端,执行:
```bash
-npm install @react-native-oh-tpl/
-// 提示:npm install @react-native-oh-tpl/flash-list(删除)
-// 提示:npm install @react-native-oh-tpl/react-native-linear-gradient(删除)
+npm i
```
下面的代码展示了这个库的基本使用场景:
@@ -90,6 +92,9 @@ var styles = StyleSheet.create({
2. 直接链接源码。
方法一:通过 har 包引入
+
+> [!TIP] har 包位于三方库安装路径的 `harmony` 文件夹下。
+
打开 `entry/oh-package.json5`,添加以下依赖
```json
@@ -110,6 +115,9 @@ ohpm install
```
方法二:直接链接源码
+
+> [!TIP] 源码位于三方库安装路径的 `harmony` 文件夹下。
+
打开 `entry/oh-package.json5`,添加以下依赖
```json
@@ -241,12 +249,25 @@ ohpm install
### 兼容性
+**已发包的库**(删除)
+
要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[ Releases](https://github.com/<仓库地址>/releases)
提示:[@react-native-oh-tpl/linear-gradient releases](https://github.com/react-native-oh-library/react-native-linear-gradient/releases)(删除)
+**未发包使用原库的库**(删除)
+
+本文档内容基于以下版本验证:
+
+```md
+- RNOH: x.x.x
+- OH SDK: x.x.x
+- IDE: x.x.x
+- ROM: xxx
+```
+
### 权限要求(如有)
(填入相关权限配置)
diff --git a/zh-cn/model.md b/zh-cn/model.md
index bc30e51b..9f500255 100644
--- a/zh-cn/model.md
+++ b/zh-cn/model.md
@@ -1,8 +1,8 @@
# 文档模板(删除)
-> [!ATTENTION] 使用模板时请将后面带有 (删除) 的语句删除。(删除)
+> [!ATTENTION] 使用模板时请将后面带有 (删除) 的语句删除。<>内是需要修改的内容。(删除)
-> 模板版本:v0.0.1
+> 模板版本:v0.1.3
<原库 npm 包名>
@@ -17,86 +17,65 @@
-## 安装与使用
-
-提示:根据 npm 包部署地方不同选用不同模板:私仓 or 公仓(删除)
-
-### 提示:私仓(删除)
-
-> [!tip] 目前部分 React-Native-OpenHarmony(RNOH) 三方库的 NPM 包部署在私仓,需要通过 github token 来获取访问权限。
-
-在与 `package.json` 文件相同的目录中,创建或编辑 `.npmrc` 文件以包含指定 GitHub Packages URL 和托管包的命名空间的行。 将 TOKEN 替换为 RNOH 三方库指定的 token。
-
-```bash
-@react-native-oh-library:registry=https://npm.pkg.github.com
-//npm.pkg.github.com/:_authToken=TOKEN
-```
-
-进入到工程目录并输入以下命令:
-
-
-
-// 未发布的代码加上如下描述(删除)
-
-**正在 npm 发布中,当前请先从仓库[Release](https://)中获取库 tgz,通过使用本地依赖来安装本库。**
+> [!tip] [Github 地址](https://github.com/<源码仓地址>)
-#### **yarn**
+如:[Github 地址](https://github.com/react-native-oh-library/react-native-linear-gradient)(已建仓的地址,未建仓则使用原库地址)(删除)
-```bash
-yarn add <原库 npm 包名>@npm:@react-native-oh-library/
-// 未发布的请使用 yarn add xxx,待发布后修改
-// 提示:yarn add @react-native-community/slider@npm:@react-native-oh-library/slider(删除)
-// 提示:yarn add react-native-translucent-modal@npm:@react-native-oh-library/(删除)react-native-translucent-modal
-```
-
-#### **npm**
-
-```bash
-npm install <原库 npm 包名>@npm:@react-native-oh-library/
-// 未发布的请使用 npm install xxx,待发布后修改
-// 提示:npm install @react-native-community/slider@npm:@react-native-oh-library/slider(删除)
-// 提示:npm install react-native-translucent-modal@npm:@react-native-oh-library/react-native-translucent-modal(删除)
-```
-
-
-
-### 提示:公仓(删除)
+## 安装与使用
进入到工程目录并输入以下命令:
-
+请到三方库的 Releases 发布地址查看配套的版本信息:[<@react-native-oh-tpl/库名> Releases](https://github.com/<仓库地址>/releases),并下载适用版本的 tgz 包。
-#### **yarn**
+进入到工程目录,打开 `package.json`,添加:
-```bash
-yarn add <原库 npm 包名>@npm:@react-native-oh-tpl/
-// 提示:yarn add @shopify/flash-list@npm:@react-native-oh-tpl/flash-list(删除)
-// 提示:yarn add react-native-linear-gradient@npm:@react-native-oh-tpl/react-native-linear-gradient(删除)
+```json
+{
+ "dpendencies": {
+ ...
+ "@react-native-oh-tpl/<库名>": "tgz包路径"
+ },
+ ...
+}
```
-#### **npm**
+打开终端,执行:
```bash
-npm install <原库 npm 包名>@npm:@react-native-oh-tpl/
-// 提示:npm install @shopify/flash-list@npm:@react-native-oh-tpl/flash-list(删除)
-// 提示:npm install react-native-linear-gradient@npm:@react-native-oh-tpl/react-native-linear-gradient(删除)
+npm i
```
-
-
下面的代码展示了这个库的基本使用场景:
```js
-// Slider 为例
-import Slider from "@react-native-community/slider";
-
-;
+// linear-gradient 为例
+import LinearGradient from "react-native-linear-gradient";
+
+// Within your render function
+
+ Sign in with Facebook
+;
+
+// Later on in your styles..
+var styles = StyleSheet.create({
+ linearGradient: {
+ flex: 1,
+ paddingLeft: 15,
+ paddingRight: 15,
+ borderRadius: 5,
+ },
+ buttonText: {
+ fontSize: 18,
+ fontFamily: "Gill Sans",
+ textAlign: "center",
+ margin: 10,
+ color: "#ffffff",
+ backgroundColor: "transparent",
+ },
+});
```
## Link
@@ -113,14 +92,16 @@ import Slider from "@react-native-community/slider";
2. 直接链接源码。
方法一:通过 har 包引入
+
+> [!TIP] har 包位于三方库安装路径的 `harmony` 文件夹下。
+
打开 `entry/oh-package.json5`,添加以下依赖
```json
"dependencies": {
"rnoh": "file:../rnoh",
- "rnoh-xxx": "file:../../node_modules/<原库 npm 包名>/harmony/.har"
- // 提示: (私仓)"rnoh-slider": "file:../../node_modules/@react-native-community/slider/harmony/slider.har"(删除)
- // 提示: (公仓)"rnoh-linear-gradient": "file:../../node_modules/react-native-linear-gradient/harmony/linear_gradient.har"(删除)
+ "rnoh-xxx": "file:../../node_modules/@react-native-oh-tpl//harmony/.har"
+ // 提示: (公仓)"rnoh-linear-gradient": "file:../../node_modules/@react-native-oh-tpl/react-native-linear-gradient/harmony/linear_gradient.har"(删除)
}
```
@@ -134,14 +115,16 @@ ohpm install
```
方法二:直接链接源码
+
+> [!TIP] 源码位于三方库安装路径的 `harmony` 文件夹下。
+
打开 `entry/oh-package.json5`,添加以下依赖
```json
"dependencies": {
"rnoh": "file:../rnoh",
- "rnoh-xxx": "file:../../node_modules/<原库 npm 包名>/harmony/"
- // 提示: (私仓)"rnoh-slider": "file:../../node_modules/@react-native-community/slider/harmony/slider"(删除)
- // 提示: (公仓)"rnoh-linear-gradient": "file:../../node_modules/react-native-linear-gradient/harmony/linear_gradient"(删除)
+ "rnoh-xxx": "file:../../node_modules/@react-native-oh-tpl//harmony/"
+ // 提示: (公仓)"rnoh-linear-gradient": "file:../../node_modules/@react-native-oh-tpl/react-native-linear-gradient/harmony/linear_gradient"(删除)
}
```
@@ -167,7 +150,7 @@ add_subdirectory("${RNOH_CPP_DIR}" ./rn)
# RNOH_BEGIN: add_package_subdirectories
add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
-+ add_subdirectory("${OH_MODULE_DIR}/rnoh-slider/src/main/cpp" ./slider)
++ add_subdirectory("${OH_MODULE_DIR}/rnoh-linear-gradient/src/main/cpp" ./linear-gradient)
# RNOH_END: add_package_subdirectories
add_library(rnoh_app SHARED
@@ -179,7 +162,7 @@ target_link_libraries(rnoh_app PUBLIC rnoh)
# RNOH_BEGIN: link_packages
target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
-+ target_link_libraries(rnoh_app PUBLIC rnoh_slider)
++ target_link_libraries(rnoh_app PUBLIC rnoh_linear_gradient)
# RNOH_END: link_packages
```
@@ -188,14 +171,14 @@ target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
```diff
#include "RNOH/PackageProvider.h"
#include "SamplePackage.h"
-+ #include "SliderPackage.h"
++ #include "LinearGradientPackage.h"
using namespace rnoh;
std::vector> PackageProvider::getPackages(Package::Context ctx) {
return {
std::make_shared(ctx),
-+ std::make_shared(ctx)
++ std::make_shared(ctx)
};
}
```
@@ -207,37 +190,28 @@ std::vector> PackageProvider::getPackages(Package::Cont
打开 `entry/src/main/ets/pages/index.ets`,添加:
```diff
-import {
- RNApp,
- ComponentBuilderContext,
- RNAbility,
- AnyJSBundleProvider,
- MetroJSBundleProvider,
- ResourceJSBundleProvider,
-} from 'rnoh'
-import { SampleView, SAMPLE_VIEW_TYPE, PropsDisplayer } from "rnoh-sample-package"
-import { createRNPackages } from '../RNPackagesFactory'
-+ import { RNCSlider, SLIDER_TYPE } from "rnoh-slider"
-
-@Builder
-function CustomComponentBuilder(ctx: ComponentBuilderContext) {
- if (ctx.descriptor.type === SAMPLE_VIEW_TYPE) {
- SampleView({
- ctx: ctx.rnohContext,
- tag: ctx.descriptor.tag,
- buildCustomComponent: CustomComponentBuilder
- })
- }
-+ else if (ctx.descriptor.type === SLIDER_TYPE) {
-+ RNCSlider({
-+ ctx: ctx.rnohContext,
-+ tag: ctx.descriptor.tag,
-+ buildCustomComponent: CustomComponentBuilder
-+ })
-+ }
- ...
-}
...
++ import { RNLinearGradient, LINEAR_GRADIENT_TYPE, LinearGradientDescriptor } from "rnoh-linear-gradient"
+
+ @Builder
+ function CustomComponentBuilder(ctx: ComponentBuilderContext) {
+ if (ctx.componentName === SAMPLE_VIEW_TYPE) {
+ SampleView({
+ ctx: ctx.rnohContext,
+ tag: ctx.tag,
+ buildCustomComponent: CustomComponentBuilder
+ })
+ }
++ else if (ctx.componentName === LINEAR_GRADIENT_TYPE) {
++ RNLinearGradient({
++ ctx: ctx.rnohContext,
++ tag: ctx.tag,
++ buildCustomComponent: CustomComponentBuilder
++ })
++ }
+ ...
+ }
+ ...
```
**提示:TurboModule**(删除)
@@ -247,8 +221,7 @@ function CustomComponentBuilder(ctx: ComponentBuilderContext) {
打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加:
```diff
-import type {RNPackageContext, RNPackage} from 'rnoh/ts';
-import {SamplePackage} from 'rnoh-sample-package/ts';
+...
+ import {AsyncStoragePackage} from 'rnoh-async-storage/ts';
export function createRNPackages(ctx: RNPackageContext): RNPackage[] {
@@ -276,30 +249,69 @@ ohpm install
### 兼容性
+**已发包的库**(删除)
+
要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[ Releases](https://github.com/<仓库地址>/releases)
-提示:[@react-native-oh-library/slider releases](https://github.com/react-native-oh-library/react-native-slider/releases)(删除)
+提示:[@react-native-oh-tpl/linear-gradient releases](https://github.com/react-native-oh-library/react-native-linear-gradient/releases)(删除)
+
+**未发包使用原库的库**(删除)
+
+本文档内容基于以下版本验证:
+
+```md
+- RNOH: x.x.x
+- OH SDK: x.x.x
+- IDE: x.x.x
+- ROM: xxx
+```
### 权限要求(如有)
(填入相关权限配置)
+**以下属性、静态方法、API 需要检查说明中手机平台描述,例如已支持鸿蒙的接口并且说明中提到 ios 和 android,那么需要检查是否补充 harmony 进到描述中。示例如下(删除)**
+
+```
+// 原描述
+Needed for Android to work properly with assets, iOS will ignore it.
+// 修改后
+Needed for Android and harmony to work properly with assets, iOS will ignore it.
+```
+
+(删除)
+
## 属性(如有)
-| 名称 | 说明 | 类型 | 是否必填 | 原库平台 | 鸿蒙支持 |
-| ---- | ---- | ---- | -------- | -------- | -------- |
+> [!tip] "Platform"列表示该属性在原三方库上支持的平台。
+
+> [!tip] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
+
+| Name | Description | Type | Required | Platform | HarmonyOS Support |
+| ---- | ----------- | ---- | -------- | -------- | ------------------ |
+| XXX | XXX | XXX | (yes/no) | xxx | (yes/no/partially) |
## 静态方法(如有)
-| 名称 | 说明 | 类型 | 是否必填 | 原库平台 | 鸿蒙支持 |
-| ---- | ---- | ---- | -------- | -------- | -------- |
+> [!tip] "Platform"列表示该属性在原三方库上支持的平台。
+
+> [!tip] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
+
+| Name | Description | Type | Required | Platform | HarmonyOS Support |
+| ---- | ----------- | ---- | -------- | -------- | ------------------ |
+| XXX | XXX | XXX | (yes/no) | xxx | (yes/no/partially) |
## API(如有,一般是 TurboModules)
-| 名称 | 说明 | 类型 | 是否必填 | 原库平台 | 鸿蒙支持 |
-| ---- | ---- | ---- | -------- | -------- | -------- |
+> [!tip] "Platform"列表示该属性在原三方库上支持的平台。
+
+> [!tip] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
+
+| Name | Description | Type | Required | Platform | HarmonyOS Support |
+| ---- | ----------- | ---- | -------- | -------- | ------------------ |
+| XXX | XXX | XXX | (yes/no) | xxx | (yes/no/partially) |
## 遗留问题
@@ -310,4 +322,6 @@ ohpm install
## 开源协议
-本项目基于 [The MIT License (MIT)](https://github.com/callstack/react-native-slider/blob/main/LICENSE.md) ,请自由地享受和参与开源。
+本项目基于 [XXX License (XXX)](https://github.com/xxx/xxx/blob/main/LICENSE.md) ,请自由地享受和参与开源。
+
+例子:本项目基于 [The MIT License (MIT)](https://github.com/callstack/react-native-slider/blob/main/LICENSE.md) ,请自由地享受和参与开源。(删除)
--
Gitee
From 3cbcbc240fc2aa1ca862044de8748fd7e339cf50 Mon Sep 17 00:00:00 2001
From: Louis-C7
Date: Wed, 31 Jan 2024 17:28:21 +0800
Subject: [PATCH 2/3] =?UTF-8?q?[Issues:=20#I908Y7]=20=E6=9B=B4=E6=96=B0?=
=?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=88=B00130=E7=89=88=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
1224/model.md | 2 ++
zh-cn/model.md | 2 ++
2 files changed, 4 insertions(+)
diff --git a/1224/model.md b/1224/model.md
index 9f500255..f064e0dd 100644
--- a/1224/model.md
+++ b/1224/model.md
@@ -47,6 +47,8 @@ npm i
下面的代码展示了这个库的基本使用场景:
+>[!WARNING] 使用时 import 的库名不变。
+
```js
// linear-gradient 为例
import LinearGradient from "react-native-linear-gradient";
diff --git a/zh-cn/model.md b/zh-cn/model.md
index 9f500255..f064e0dd 100644
--- a/zh-cn/model.md
+++ b/zh-cn/model.md
@@ -47,6 +47,8 @@ npm i
下面的代码展示了这个库的基本使用场景:
+>[!WARNING] 使用时 import 的库名不变。
+
```js
// linear-gradient 为例
import LinearGradient from "react-native-linear-gradient";
--
Gitee
From 96e6427512b326a28f68dc1f9a7e317a15397305 Mon Sep 17 00:00:00 2001
From: Louis-C7
Date: Wed, 31 Jan 2024 17:40:23 +0800
Subject: [PATCH 3/3] =?UTF-8?q?[Issues:=20#I908Y7]=20=E7=89=88=E6=9C=AC?=
=?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=A8=A1=E6=9D=BF=E5=8F=98=E6=9B=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
1224/model.md | 8 ++------
zh-cn/model.md | 8 ++------
2 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/1224/model.md b/1224/model.md
index f064e0dd..6edf3a44 100644
--- a/1224/model.md
+++ b/1224/model.md
@@ -263,12 +263,8 @@ ohpm install
本文档内容基于以下版本验证:
-```md
-- RNOH: x.x.x
-- OH SDK: x.x.x
-- IDE: x.x.x
-- ROM: xxx
-```
+1. RNOH: x.x.x; OH SDK: x.x.x; IDE: x.x.x; ROM: xxx;
+2. (如有)
### 权限要求(如有)
diff --git a/zh-cn/model.md b/zh-cn/model.md
index f064e0dd..6edf3a44 100644
--- a/zh-cn/model.md
+++ b/zh-cn/model.md
@@ -263,12 +263,8 @@ ohpm install
本文档内容基于以下版本验证:
-```md
-- RNOH: x.x.x
-- OH SDK: x.x.x
-- IDE: x.x.x
-- ROM: xxx
-```
+1. RNOH: x.x.x; OH SDK: x.x.x; IDE: x.x.x; ROM: xxx;
+2. (如有)
### 权限要求(如有)
--
Gitee