Merged
docs: upgrade master README/README_en to v0.4.2 template #28
fangzhenAdd on Oct 22
docs: upgrade master README/README_en to v0.4.2 template #28
Merged
fangzhenAdd on Oct 22
Total: 2 files changed+737-8
MREADME.md+363-8
@@ -1,17 +1,372 @@
1-# react-native-image-rotate1+> 文档模板:v0.4.2
2 2 
3-本项目基于 [react-native-image-rotate](https://github.com/dgladkov/react-native-image-rotate)3+<p align="center">
4+ <h1 align="center"> <code>react-native-image-rotate</code> </h1>
5+</p>
4 6 
5-## 文档地址 / Documentation URL 7+本项目基于 [react-native-image-rotate](https://github.com/dgladkov/react-native-image-rotate) 开发。
cpf-manager

【AI-Review】【一般】【业务功能】【其他功能问题】 ● 问题: README.md 作为仓库默认入口,整体内容为中文(如第 7 行"本项目基于..."、第 20 行"react-native-image-rotate 用于在 React Native 应用中旋转图片"等),且本次 PR 将原 README.md 中仅有的英文段落(原第 13 行"The library has been integrated with codegen...")与"## 文档地址 / Documentation URL"中英切换入口一并删除。这违反了文档语言规范中"根目录 README.md 和文档默认首页/默认语言必须为英文"以及"不得将中文设为默认入口"的要求;同时 README.md 与本次新增的 README_en.md 均未提供清晰可见的中英文切换入口。

● 影响: 用户访问仓库默认页面时仅看到中文 README,且没有任何链接指向英文版 README_en.md,不符合 CPF-RN 三方库文档语言与默认入口规范,影响国际用户的使用体验与规范合规性。

● 建议: 将 README.md 内容调整为英文(可将现 README_en.md 的英文内容作为默认 README.md),将中文版本另存为 README_zh.md(或类似命名),并在两个文件标题下方添加清晰可见的语言切换链接(如 [中文](./README_zh.md) | [English](./README.md))。

likedislike
fangzhen
fangzhen
Oct 22 Comments:
likedislike
6 8 
7-[中文 / Chinese](https://gitcode.com/OpenHarmony-RN/usage-docs/tree/master/zh-cn/react-native-image-rotate.md)9+该第三方库的仓库已迁移至 GitCode,且支持直接从 npm 下载,新的包名为:`@react-native-ohos/react-native-image-rotate`,版本所属关系如下:
8 10 
9-## Codegen11+| 三方库名称 | 三方库版本(npm地址) | 发布信息 | 支持RN版本 | Autolink | 编译API版本 | 社区基线版本 | 源码地址 |
12+| ------------ | ------------ | ------------------------------ | ------------- | ------------- |------------------------ | ------------- | ------------- |
13+| @react-native-ohos/react-native-image-rotate | [~2.3.0(开发中)](https://www.npmjs.com/package/@react-native-ohos/react-native-image-rotate) | [GitCode Releases](https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/releases) | 0.82.* | 是 | API12+ | 2.1.0 | [br_rnoh0.82](https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/tree/br_rnoh0.82) |
14+| @react-native-ohos/react-native-image-rotate | [~2.2.0](https://www.npmjs.com/package/@react-native-ohos/react-native-image-rotate) | [GitCode Releases](https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/releases) | 0.77.* | 否 | API12+ | 2.1.0 | [br_rnoh0.77](https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/tree/br_rnoh0.77) |
15+| @react-native-ohos/react-native-image-rotate | [~2.1.1](https://www.npmjs.com/package/@react-native-ohos/react-native-image-rotate) | [GitCode Releases](https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/releases) | 0.72.* | 是 | API12+ | 2.1.0 | [br_rnoh0.72](https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/tree/br_rnoh0.72) |
16+| @react-native-oh-tpl/react-native-image-rotate | [<= 2.1.0-0.0.3@deprecated](https://www.npmjs.com/package/@react-native-oh-tpl/react-native-image-rotate) | [Github Releases(deprecated)](https://github.com/react-native-oh-library/react-native-image-rotate/releases) | 0.72.* | 否 | API12+ | 2.1.0 | [sig](https://github.com/react-native-oh-library/react-native-image-rotate) |
10 17 
11-该库已接入 codegen,具体请查阅文档。18+## 简介
12 19 
13-The library has been integrated with codegen. Please refer to the documentation for details.20+react-native-image-rotate 用于在 React Native 应用中旋转图片。<br/>
21+提供 `rotateImage` 静态方法,支持对本地或网络图片进行旋转,旋转角度为 90 的倍数(负值表示逆时针),成功后返回新图片的 URI。
14 22 
15-## 请悉知 / Acknowledgements23+## 下载安装
24+ 
25+进入到工程目录并输入以下命令:
26+ 
27+**npm**
28+ 
29+```bash
30+npm install @react-native-ohos/react-native-image-rotate
31+```
32+ 
33+**yarn**
34+ 
35+```bash
36+yarn add @react-native-ohos/react-native-image-rotate
37+```
38+ 
39+## Link
40+ 
41+| 版本 | 是否支持autolink | RN框架版本 |
42+|--------------------------------------|----------------|-----------|
43+| ~2.3.0 | 是 | 0.82.* |
cpf-manager

【AI-Review】【一般】【业务功能】【功能实现错误】 ● 问题: 第 41-43 行 Link 表仅列出 ~2.3.0(0.82.,是)一条记录,但第 15 行版本表中 ~2.1.1(0.72.)的 Autolink 列标记为"是",即同样支持 Autolink。第 47 行说明"如您使用的版本支持 Autolink,并且工程已接入 Autolink,可跳过ManualLink配置",表明存在多个支持 Autolink 的版本。Link 表与版本表关于 Autolink 支持范围的信息不一致。

● 影响: 使用 RN 0.72.* + ~2.1.1 的用户在版本表中看到自身版本支持 Autolink,但在 Link 表中找不到对应条目,无法判断是否需要按 Link 表配置,造成使用困惑。

● 建议: 若 ~2.1.1 确实支持 Autolink,请在 Link 表中补充 ~2.1.1 | 是 | 0.72.* 一行;若不支持,请将第 15 行版本表中 ~2.1.1 的 Autolink 列更正为"否",使两表信息一致。

likedislike
fangzhen
fangzhen
Oct 22 Comments:
likedislike
44+ 
45+使用AutoLink的工程需要根据该文档配置,Autolink框架指导文档:https://gitcode.com/CPF-RN/ohos_react_native/blob/main/docs/zh-cn/02-开发/02-开发指南/Autolinking.md
46+ 
47+如您使用的版本支持 Autolink,并且工程已接入 Autolink,可跳过ManualLink配置。
48+<details>
49+ <summary>ManualLink: 此步骤为手动配置原生依赖项的指导</summary>
50+ 
51+首先需要使用 DevEco Studio 打开项目里的 HarmonyOS 工程 `harmony`。
52+ 
53+### 1. Overrides RN SDK
54+ 
55+为了让工程依赖同一个版本的 RN SDK,需要在工程根目录的 `oh-package.json5` 添加 overrides 字段,指向工程需要使用的 RN SDK 版本。替换的版本既可以是一个具体的版本号,也可以是一个模糊版本,还可以是本地存在的 HAR 包或源码目录。
56+ 
57+关于该字段的作用请阅读[官方说明](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/ide-oh-package-json5-V5#zh-cn_topic_0000001792256137_overrides)
58+ 
59+```json
60+{
61+ "overrides": {
62+ "@rnoh/react-native-openharmony": "~0.82.18" // ohpm 在线版本
63+ // "@rnoh/react-native-openharmony" : "./react_native_openharmony.har" // 指向本地 har 包的路径
64+ // "@rnoh/react-native-openharmony" : "./react_native_openharmony" // 指向源码路径
65+ }
66+}
67+```
68+ 
69+### 2. 引入原生端代码
70+ 
71+目前有两种方法:
72+ 
73+- 通过 har 包引入;
74+- 直接链接源码。
75+ 
76+方法一:通过 har 包引入(推荐)
77+ 
78+> [!TIP] har 包位于三方库安装路径的 `harmony` 文件夹下。
79+ 
80+打开 `entry/oh-package.json5`,添加以下依赖
81+ 
82+```json
83+"dependencies": {
84+ "@react-native-ohos/react-native-image-rotate": "file:../../node_modules/@react-native-ohos/react-native-image-rotate/harmony/imageRotate.har"
85+ }
86+```
87+ 
88+点击右上角的 `sync` 按钮
89+ 
90+或者在命令行终端执行:
91+ 
92+```bash
93+cd entry
94+ohpm install
95+```
96+ 
97+方法二:直接链接源码
98+ 
99+> [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](https://gitcode.com/CPF-RN/usage-docs/blob/master/zh-cn/link-source-code.md)
100+ 
101+### 3. 配置 CMakeLists 和引入 ImageRotatePackage
102+ 
103+打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
104+ 
105+```diff
106+project(rnapp)
107+cmake_minimum_required(VERSION 3.4.1)
108+set(CMAKE_SKIP_BUILD_RPATH TRUE)
109+set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
110+set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules")
111++ set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
112+set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
113+set(LOG_VERBOSITY_LEVEL 1)
114+set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments")
115+set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie")
116+set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use
117+add_compile_definitions(WITH_HITRACE_SYSTRACE)
118+ 
119+add_subdirectory("${RNOH_CPP_DIR}" ./rn)
120+ 
121+# RNOH_BEGIN: manual_package_linking_1
122+add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
123++ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-image-rotate/src/main/cpp" ./imageRotate)
124+# RNOH_END: manual_package_linking_1
125+ 
126+file(GLOB GENERATED_CPP_FILES "./generated/*.cpp")
127+ 
128+add_library(rnoh_app SHARED
129+ ${GENERATED_CPP_FILES}
130+ "./PackageProvider.cpp"
131+ "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
132+)
133+target_link_libraries(rnoh_app PUBLIC rnoh)
134+ 
135+# RNOH_BEGIN: manual_package_linking_2
136+target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
137++ target_link_libraries(rnoh_app PUBLIC rnoh_imageRotate)
138+# RNOH_END: manual_package_linking_2
139+```
140+ 
141+打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
142+ 
143+```diff
144+#include "RNOH/PackageProvider.h"
145+#include "SamplePackage.h"
146++ #include "ImageRotatePackage.h"
147+ 
148+using namespace rnoh;
149+ 
150+std::vector<std::shared_ptr<Package>> PackageProvider::getPackages(Package::Context ctx) {
151+ return {
152+ std::make_shared<SamplePackage>(ctx),
153++ std::make_shared<ImageRotatePackage>(ctx)
154+ };
155+}
156+```
157+ 
158+### 4. 在 ArkTs 侧引入 RNImageRotatePackage
159+ 
160+打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加:
161+ 
162+```diff
163+ ...
164+ 
165++ import { RNImageRotatePackage } from '@react-native-ohos/react-native-image-rotate/ts';
166+ 
167+export function createRNPackages(ctx: RNPackageContext): RNPackage[] {
168+ return [
169+ new SamplePackage(ctx),
170++ new RNImageRotatePackage(ctx)
171+ ];
172+}
173+```
174+</details>
175+ 
176+### 运行
177+ 
178+点击右上角的 `sync` 按钮
179+ 
180+或者在命令行终端执行:
181+ 
182+```bash
183+cd entry
184+ohpm install
185+```
186+ 
187+然后编译、运行即可。
188+ 
189+## 约束与限制
190+ 
191+### 兼容性
192+ 
193+本文档内容基于以下版本验证通过:
194+ 
195+1. RNOH: 0.82.7; SDK: HarmonyOS 6.0.1 Release SDK; IDE: DevEco Studio 6.0.1 Release; ROM:6.0.0.328 SP26;
196+ 
197+### 权限要求
198+ 
199+- 如果传入的图片 uri 为网络地址,应用需要申请网络权限
200+ 
201+ 在`entry/src/main/module.json5`中添加
202+ 
203+```json
204+requestPermissions: [
205+ {
206+ name: "ohos.permission.INTERNET",
207+ },
208+],
209+```
210+ 
211+### 编译运行API要求
212+ 
213+> [!TIP] 当前三方库所有版本均已实现版本隔离,支持在 `API12+` 工程编译,及 `API12+` ROM运行。
214+ 
215+## 使用示例
216+下面的代码展示了这个库的基本使用场景:
217+ 
218+> [!WARNING] 使用时 import 的库名不变。
219+ 
220+```js
221+import React, { Component } from 'react';
222+import {
223+ Image,
224+ StyleSheet,
225+ Text,
226+ TouchableHighlight,
227+ View
228+} from 'react-native';
229+ 
230+import ImageRotate from 'react-native-image-rotate';
231+ 
232+const SOURCE_IMAGE = 'https://upload.wikimedia.org/wikipedia/en/5/56/Warcraft_Teaser_Poster.jpg';
233+ 
234+export default class App extends Component {
235+ 
236+ constructor() {
237+ super();
238+ this.state = {
239+ image: SOURCE_IMAGE,
240+ currentAngle: 0,
241+ width: 150,
242+ height: 240,
243+ };
244+ 
245+ this.rotate = this.rotate.bind(this);
246+ }
247+ 
248+ rotate(angle) {
249+ const nextAngle = this.state.currentAngle + angle;
250+ ImageRotate.rotateImage(
251+ SOURCE_IMAGE,
252+ nextAngle,
253+ (uri) => {
254+ this.setState({
255+ image: uri,
256+ currentAngle: nextAngle,
257+ width: this.state.height,
258+ height: this.state.width,
259+ });
260+ },
261+ (error) => {
262+ console.error(error);
263+ }
264+ );
265+ }
266+ 
267+ render() {
268+ return (
269+ <View style={styles.container}>
270+ <View style={styles.imageContainer}>
271+ <Image style={{width: this.state.width, height: this.state.height}} source={{uri: this.state.image}} />
272+ </View>
273+ <TouchableHighlight
274+ onPress={() => this.rotate(90)}
275+ style={styles.button}
276+ >
277+ <Text style={styles.text}>ROTATE CW</Text>
278+ </TouchableHighlight>
279+ 
280+ <TouchableHighlight
281+ onPress={() => this.rotate(-90)}
282+ style={styles.button}
283+ >
284+ <Text style={styles.text}>ROTATE CCW</Text>
285+ </TouchableHighlight>
286+ </View>
287+ );
288+ }
289+}
290+ 
291+const styles = StyleSheet.create({
292+ container: {
293+ flex: 1,
294+ justifyContent: 'center',
295+ alignItems: 'center',
296+ backgroundColor: '#F5FCFF',
297+ },
298+ button: {
299+ backgroundColor: 'red',
300+ padding: 5,
301+ margin: 5,
302+ },
303+ imageContainer: {
304+ height: 240,
305+ justifyContent: 'center',
306+ },
307+ text: {
308+ color: 'white',
309+ },
310+});
311+```
312+ 
313+## 使用说明
314+ 
315+**旋转图片**
316+ 
317+调用 `ImageRotate.rotateImage` 静态方法旋转图片。`uri` 支持本地路径与网络地址(网络图片会自动下载),`angle` 为旋转角度,仅支持 90 的倍数(负值表示逆时针);成功回调返回旋转后图片的 URI,失败回调返回错误信息。
318+ 
319+```js
320+ImageRotate.rotateImage(
321+ uri,
322+ 90,
323+ (rotatedUri) => {
324+ // 旋转成功,rotatedUri 为旋转后图片的 URI
325+ },
326+ (error) => {
327+ // 旋转失败
328+ }
329+);
330+```
331+ 
332+## 接口说明
333+ 
334+> [!TIP] "Platform"列表示该属性在原三方库上支持的平台。
335+ 
336+> [!TIP] "OpenHarmony Support"列为 yes 表示 OpenHarmony平台支持 该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
337+ 
338+### API
339+| 名称 | 类型 | 参数类型 | 返回值 | 必填 | 平台 | OpenHarmony平台支持 | 描述 |
340+|--------|---------|-----|-------|-------|--------|-----|-----------------|
341+| rotateImage | function | uri: string, angle: number, success: (uri: string) => void, failure: (error: Object) => void | void | no | iOS/Android | Yes | 旋转图片。仅支持 90 的倍数角度,负角度表示逆时针旋转;成功回调返回旋转后图片的 URI,失败回调返回错误信息。|
342+ 
343+## 遗留问题
344+ 
345+## 其他
346+无
347+ 
348+## 目录结构
349+ 
350+````
351+/rntpc_react-native-image-rotate # 项目根目录
352+├── harmony/
353+│ ├── imageRotate/
354+│ └── imageRotate.har
355+├── src/
356+│ └── NativeImageRotate.ts
357+├── index.js
358+├── LICENSE # 开源协议文件
359+├── OAT.xml # OAT 自检配置
360+├── package.json # 包配置
361+├── README_en.md # 英文安装使用方法
362+├── README.md # 中文安装使用方法
363+└── RNImageRotate.podspec
364+````
365+ 
366+## 贡献代码
367+ 
368+使用过程中发现任何问题都可以提交 [Issue](https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/issues),当然,也非常欢迎提交 [PR](https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/pulls) 。
369+ 
370+## 开源协议
16 371 
17本项目基于 [The MIT License (MIT)](https://github.com/dgladkov/react-native-image-rotate/blob/master/LICENSE) ,请自由地享受和参与开源。372本项目基于 [The MIT License (MIT)](https://github.com/dgladkov/react-native-image-rotate/blob/master/LICENSE) ,请自由地享受和参与开源。
@@ -0,0 +1,374 @@
1+> Document Template: v0.4.2
2+ 
3+<p align="center">
4+ <h1 align="center"> <code>react-native-image-rotate</code> </h1>
5+</p>
6+ 
7+This project is based on [react-native-image-rotate](https://github.com/dgladkov/react-native-image-rotate).
8+ 
9+This third-party library has been migrated to GitCode and is now available for direct download from npm, the new package name is: `@react-native-ohos/react-native-image-rotate`, the version correspondence details are as follows:
10+ 
11+| Name | Version(Npm Address) | Release Information | Supported RN Version | Supported Autolink | Compile API Version | Community Baseline Version | Source code address |
12+| --------------| -------------- | ------------------------------ | ------------- | ------------- |------------------------ | ------------ | ------------- |
13+| @react-native-ohos/react-native-image-rotate | [~2.3.0 (In development)](https://www.npmjs.com/package/@react-native-ohos/react-native-image-rotate) | [GitCode Releases](https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/releases) | 0.82.* | Yes | API12+ | 2.1.0 | [br_rnoh0.82](https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/tree/br_rnoh0.82) |
14+| @react-native-ohos/react-native-image-rotate | [~2.2.0](https://www.npmjs.com/package/@react-native-ohos/react-native-image-rotate) | [GitCode Releases](https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/releases) | 0.77.* | No | API12+ | 2.1.0 | [br_rnoh0.77](https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/tree/br_rnoh0.77) |
15+| @react-native-ohos/react-native-image-rotate | [~2.1.1](https://www.npmjs.com/package/@react-native-ohos/react-native-image-rotate) | [GitCode Releases](https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/releases) | 0.72.* | Yes | API12+ | 2.1.0 | [br_rnoh0.72](https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/tree/br_rnoh0.72) |
16+| @react-native-oh-tpl/react-native-image-rotate | [<= 2.1.0-0.0.3@deprecated](https://www.npmjs.com/package/@react-native-oh-tpl/react-native-image-rotate) | [Github Releases(deprecated)](https://github.com/react-native-oh-library/react-native-image-rotate/releases) | 0.72.* | No | API12+ | 2.1.0 | [sig](https://github.com/react-native-oh-library/react-native-image-rotate) |
17+ 
18+## Introduction
19+ 
20+react-native-image-rotate is used to rotate images in React Native applications.
21+It provides the `rotateImage` static method, which rotates local or remote images by multiples of 90 degrees (negative values indicate counter-clockwise rotation) and returns the URI of the rotated image on success.
22+ 
23+## Installation
24+ 
25+Go to the project directory and execute the following instruction:
26+ 
27+**npm**
28+ 
29+```bash
30+npm install @react-native-ohos/react-native-image-rotate
31+```
32+ 
33+**yarn**
34+ 
35+```bash
36+yarn add @react-native-ohos/react-native-image-rotate
37+```
38+ 
39+## Link
40+ 
41+| Version | Supported Autolink | Supported RN Version |
42+|--------------------------------------|--------------------|----------------------|
43+| ~2.3.0 | Yes | 0.82.* |
cpf-manager

【AI-Review】【一般】【业务功能】【功能实现错误】 ● 问题: 第 41-43 行 Link 表仅列出 ~2.3.0(0.82., Yes)一条记录,但第 15 行版本表中 ~2.1.1(0.72.)的 Supported Autolink 列标记为"Yes",即同样支持 Autolink。第 47 行说明"If the version you are using supports Autolink...",表明存在多个支持 Autolink 的版本。Link 表与版本表关于 Autolink 支持范围的信息不一致。

● 影响: 使用 RN 0.72.* + ~2.1.1 的用户在版本表中看到自身版本支持 Autolink,但在 Link 表中找不到对应条目,无法判断是否需要按 Link 表配置,造成使用困惑。

● 建议: 若 ~2.1.1 确实支持 Autolink,请在 Link 表中补充 ~2.1.1 | Yes | 0.72.* 一行;若不支持,请将第 15 行版本表中 ~2.1.1 的 Supported Autolink 列更正为"No",使两表信息一致。

likedislike
fangzhen
fangzhen
Oct 22 Comments:
likedislike
44+ 
45+Projects using AutoLink need to be configured according to this document, AutoLink framework guide: https://gitcode.com/CPF-RN/ohos_react_native/blob/main/docs/en/02-development/02-development-guide/autolinking.md
46+ 
47+If the version you are using supports Autolink and the project has integrated Autolink, you can skip the ManualLink configuration.
48+ 
49+<details>
50+ <summary>ManualLink: This step provides guidance for manually configuring native dependencies.</summary>
51+ 
52+Open the `harmony` directory of the OpenHarmony project in DevEco Studio.
53+ 
54+### 1. Overrides RN SDK
55+ 
56+To ensure the project relies on the same version of the RN SDK, you need to add an `overrides` field in the project's root `oh-package.json5` file, specifying the RN SDK version to be used. The replacement version can be a specific version number, a semver range, or a locally available HAR package or source directory.
57+ 
58+For more information about the purpose of this field, please refer to the [official documentation](https://developer.huawei.com/consumer/en/doc/harmonyos-guides-V5/ide-oh-package-json5-V5#en-us_topic_0000001792256137_overrides).
59+ 
60+```json
61+{
62+ "overrides": {
63+ "@rnoh/react-native-openharmony": "~0.82.18" // ohpm version
64+ // "@rnoh/react-native-openharmony" : "./react_native_openharmony.har" // a locally available HAR package
65+ // "@rnoh/react-native-openharmony" : "./react_native_openharmony" // source code directory
66+ }
67+}
68+```
69+ 
70+### 2. Introducing Native Code
71+ 
72+Currently, two methods are available:
73+ 
74+- Use the HAR file.
75+- Directly link to the source code.
76+ 
77+Method 1 (recommended): Use the HAR file.
78+ 
79+> [!TIP] The HAR file is stored in the `harmony` directory in the installation path of the third-party library.
80+ 
81+Open entry/oh-package.json5 file and add the following dependencies:
82+ 
83+```json
84+"dependencies": {
85+ "@react-native-ohos/react-native-image-rotate": "file:../../node_modules/@react-native-ohos/react-native-image-rotate/harmony/imageRotate.har"
86+ }
87+```
88+ 
89+Click the `sync` button in the upper right corner.
90+ 
91+Alternatively, run the following instruction on the terminal:
92+ 
93+```bash
94+cd entry
95+ohpm install
96+```
97+ 
98+Method 2: Directly link to the source code.
99+ 
100+> [!TIP] For details, see [Directly Linking Source Code](https://gitcode.com/CPF-RN/usage-docs/blob/master/en/link-source-code.md)
101+ 
102+### 3. Configuring CMakeLists and Introducing ImageRotatePackage
103+ 
104+Open `entry/src/main/cpp/CMakeLists.txt` and add the following code:
105+ 
106+```diff
107+project(rnapp)
108+cmake_minimum_required(VERSION 3.4.1)
109+set(CMAKE_SKIP_BUILD_RPATH TRUE)
110+set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
111+set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules")
112++ set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
113+set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
114+set(LOG_VERBOSITY_LEVEL 1)
115+set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments")
116+set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie")
117+set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use
118+add_compile_definitions(WITH_HITRACE_SYSTRACE)
119+ 
120+add_subdirectory("${RNOH_CPP_DIR}" ./rn)
121+ 
122+# RNOH_BEGIN: manual_package_linking_1
123+add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
124++ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-image-rotate/src/main/cpp" ./imageRotate)
125+# RNOH_END: manual_package_linking_1
126+ 
127+file(GLOB GENERATED_CPP_FILES "./generated/*.cpp")
128+ 
129+add_library(rnoh_app SHARED
130+ ${GENERATED_CPP_FILES}
131+ "./PackageProvider.cpp"
132+ "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
133+)
134+target_link_libraries(rnoh_app PUBLIC rnoh)
135+ 
136+# RNOH_BEGIN: manual_package_linking_2
137+target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
138++ target_link_libraries(rnoh_app PUBLIC rnoh_imageRotate)
139+# RNOH_END: manual_package_linking_2
140+```
141+ 
142+Open `entry/src/main/cpp/PackageProvider.cpp` and add the following code:
143+ 
144+```diff
145+#include "RNOH/PackageProvider.h"
146+#include "SamplePackage.h"
147++ #include "ImageRotatePackage.h"
148+ 
149+using namespace rnoh;
150+ 
151+std::vector<std::shared_ptr<Package>> PackageProvider::getPackages(Package::Context ctx) {
152+ return {
153+ std::make_shared<SamplePackage>(ctx),
154++ std::make_shared<ImageRotatePackage>(ctx)
155+ };
156+}
157+```
158+ 
159+### 4. Introducing RNImageRotatePackage to ArkTS
160+ 
161+Open the entry/src/main/ets/RNPackagesFactory.ts file and add the following code:
162+ 
163+```diff
164+ ...
165+ 
166++ import { RNImageRotatePackage } from '@react-native-ohos/react-native-image-rotate/ts';
167+ 
168+export function createRNPackages(ctx: RNPackageContext): RNPackage[] {
169+ return [
170+ new SamplePackage(ctx),
171++ new RNImageRotatePackage(ctx)
172+ ];
173+}
174+```
175+</details>
176+ 
177+### Running
178+ 
179+Click the `sync` button in the upper right corner.
180+ 
181+Alternatively, run the following instruction on the terminal:
182+ 
183+```bash
184+cd entry
185+ohpm install
186+```
187+ 
188+Then build and run the code.
189+ 
190+## Constraints
191+ 
192+### Compatibility
193+ 
194+This document is verified based on the following versions:
195+ 
196+1. RNOH: 0.82.7; SDK: HarmonyOS 6.0.1 Release SDK; IDE: DevEco Studio 6.0.1 Release; ROM:6.0.0.328 SP26;
197+ 
198+### Permission Requirements
199+ 
200+- If the image uri is a network URL, the application needs to apply for network permissions.
201+ 
202+ Include applicable permissions in the `entry/src/main/module.json5` file within the entry directory.
203+ 
204+```json
205+requestPermissions: [
206+ {
207+ name: "ohos.permission.INTERNET",
208+ },
209+],
210+```
211+ 
212+### API requirements
213+ 
214+> [!TIP] All versions of the current third-party libraries have implemented version isolation, supporting compilation in `API12+` projects and execution on `API12+` ROMs.
215+ 
216+## Example
217+ 
218+The following code shows the basic use scenario of the repository:
219+ 
220+> [!WARNING] The name of the imported repository remains unchanged.
221+ 
222+```js
223+import React, { Component } from 'react';
224+import {
225+ Image,
226+ StyleSheet,
227+ Text,
228+ TouchableHighlight,
229+ View
230+} from 'react-native';
231+ 
232+import ImageRotate from 'react-native-image-rotate';
233+ 
234+const SOURCE_IMAGE = 'https://upload.wikimedia.org/wikipedia/en/5/56/Warcraft_Teaser_Poster.jpg';
235+ 
236+export default class App extends Component {
237+ 
238+ constructor() {
239+ super();
240+ this.state = {
241+ image: SOURCE_IMAGE,
242+ currentAngle: 0,
243+ width: 150,
244+ height: 240,
245+ };
246+ 
247+ this.rotate = this.rotate.bind(this);
248+ }
249+ 
250+ rotate(angle) {
251+ const nextAngle = this.state.currentAngle + angle;
252+ ImageRotate.rotateImage(
253+ SOURCE_IMAGE,
254+ nextAngle,
255+ (uri) => {
256+ this.setState({
257+ image: uri,
258+ currentAngle: nextAngle,
259+ width: this.state.height,
260+ height: this.state.width,
261+ });
262+ },
263+ (error) => {
264+ console.error(error);
265+ }
266+ );
267+ }
268+ 
269+ render() {
270+ return (
271+ <View style={styles.container}>
272+ <View style={styles.imageContainer}>
273+ <Image style={{width: this.state.width, height: this.state.height}} source={{uri: this.state.image}} />
274+ </View>
275+ <TouchableHighlight
276+ onPress={() => this.rotate(90)}
277+ style={styles.button}
278+ >
279+ <Text style={styles.text}>ROTATE CW</Text>
280+ </TouchableHighlight>
281+ 
282+ <TouchableHighlight
283+ onPress={() => this.rotate(-90)}
284+ style={styles.button}
285+ >
286+ <Text style={styles.text}>ROTATE CCW</Text>
287+ </TouchableHighlight>
288+ </View>
289+ );
290+ }
291+}
292+ 
293+const styles = StyleSheet.create({
294+ container: {
295+ flex: 1,
296+ justifyContent: 'center',
297+ alignItems: 'center',
298+ backgroundColor: '#F5FCFF',
299+ },
300+ button: {
301+ backgroundColor: 'red',
302+ padding: 5,
303+ margin: 5,
304+ },
305+ imageContainer: {
306+ height: 240,
307+ justifyContent: 'center',
308+ },
309+ text: {
310+ color: 'white',
311+ },
312+});
313+```
314+ 
315+## How to Use
316+ 
317+**Rotate Image**
318+ 
319+Call the `ImageRotate.rotateImage` static method to rotate an image. `uri` supports both local paths and network URLs (remote images are downloaded automatically). `angle` is the rotation angle and must be a multiple of 90 (negative values indicate counter-clockwise rotation). The success callback returns the URI of the rotated image, and the failure callback returns the error information.
320+ 
321+```js
322+ImageRotate.rotateImage(
323+ uri,
324+ 90,
325+ (rotatedUri) => {
326+ // Rotation succeeded, rotatedUri is the URI of the rotated image
327+ },
328+ (error) => {
329+ // Rotation failed
330+ }
331+);
332+```
333+ 
334+## Available APIs
335+ 
336+> [!TIP] The **Platform** column indicates the platform where the properties are supported in the original third-party library.
337+ 
338+> [!TIP] If the value of **OpenHarmony Platform Support** is **yes**, it means that the OpenHarmony platform supports this property; **no** means the opposite; **partially** means some capabilities of this property are supported. The usage method is the same on different platforms and the effect is the same as that of iOS or Android.
339+ 
340+### API
341+| Name | Type | Parameter Type | Return Value | Required | Platform | OpenHarmony Platform Support | Description |
342+|--------|---------|-----|-------|-------|--------|-----|-----------------|
343+| rotateImage | function | uri: string, angle: number, success: (uri: string) => void, failure: (error: Object) => void | void | no | iOS/Android | Yes | Rotates an image. Only angles that are multiples of 90 are supported, negative angles indicate counter-clockwise rotation; the success callback returns the URI of the rotated image, and the failure callback returns the error information.|
344+ 
345+## Known Issues
346+ 
347+## Other
348+None
349+ 
350+## Directory Structure
351+ 
352+````
353+/rntpc_react-native-image-rotate # Project root
354+├── harmony/
355+│ ├── imageRotate/
356+│ └── imageRotate.har
357+├── src/
358+│ └── NativeImageRotate.ts
359+├── index.js
360+├── LICENSE # License file
361+├── OAT.xml # OAT self-check configuration
362+├── package.json # Package configuration
363+├── README_en.md # English installation and usage guide
364+├── README.md # Chinese installation and usage guide
365+└── RNImageRotate.podspec
366+````
367+ 
368+## How to Contribute
369+ 
370+If you find any problem when using react-native-image-rotate, submit an [issue](https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/issues) or a [PR](https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/pulls).
371+ 
372+## License
373+ 
374+The repository is based on [The MIT License (MIT)](https://github.com/dgladkov/react-native-image-rotate/blob/master/LICENSE).