Open
fix:Optimizing the stability of rotating HTTP downloads and reusing the same URL in network diagrams.add jest and update example.version:2.2.1-beta.2 #30
fix:Optimizing the stability of rotating HTTP downloads and reusing the same URL in network diagrams.add jest and update example.version:2.2.1-beta.2 #30
Open
yanPengAdd on 22 hours ago
Total: 22 files changed+1015-277
@@ -33,6 +33,10 @@ local.properties
33node_modules/33node_modules/
34npm-debug.log34npm-debug.log
35 35 
36+# jest / test artifacts
37+jest/coverage/
38+coverage/
39+ 
36# BUCK40# BUCK
37buck-out/41buck-out/
38\.buckd/42\.buckd/
@@ -48,3 +48,7 @@ ios/Pods
48/example48/example
49docs/49docs/
50*.tgz50*.tgz
51+ 
52+# jest / test artifacts
53+/jest
54+/coverage
@@ -1,5 +1,9 @@
1# 鸿蒙化Log1# 鸿蒙化Log
2 2 
3+## v2.2.1-beta.2
4+### Fixed
5+- Optimizing the stability of rotating HTTP downloads and reusing the same URL in network diagrams.add jest and update example [#30](https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/pull/30)
6+ 
3## v2.2.1-beta.17## v2.2.1-beta.1
4### Fixed8### Fixed
5- Modify rotateImage method to decode and rotate failed error callback,addd exapmle [#26](https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/pull/26)9- Modify rotateImage method to decode and rotate failed error callback,addd exapmle [#26](https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/pull/26)
MOAT.xml+7-1
@@ -25,6 +25,8 @@
25 <filteritem type="filepath" name="harmony/imageRotate/src/main/ets/generated/**/*" desc="codegen自动生成,不手动修改"/>25 <filteritem type="filepath" name="harmony/imageRotate/src/main/ets/generated/**/*" desc="codegen自动生成,不手动修改"/>
26 <filteritem type="filename" name=".npmignore" desc="工程配置文件,不手动修改"/>26 <filteritem type="filename" name=".npmignore" desc="工程配置文件,不手动修改"/>
27 <filteritem type="filepath" name="buildEnv.sh" desc="构建环境脚本,不添加版权头"/>27 <filteritem type="filepath" name="buildEnv.sh" desc="构建环境脚本,不添加版权头"/>
28+ <filteritem type="filepath" name="jest/**/*" desc="jest测试配置及测试用例,不添加版权头"/>
29+ <filteritem type="filepath" name="example/**/*" desc="示例代码,不添加版权头"/>
28 </filefilter>30 </filefilter>
29 <filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies">31 <filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies">
30 <filteritem type="filepath" name="harmony/imageRotate/hvigorfile.ts" desc="hvigor构建脚本,DevEco Studio自动生成,不手动修改"/>32 <filteritem type="filepath" name="harmony/imageRotate/hvigorfile.ts" desc="hvigor构建脚本,DevEco Studio自动生成,不手动修改"/>
@@ -36,11 +38,15 @@
36 <filteritem type="filepath" name="harmony/imageRotate/src/main/ets/generated/**/*" desc="codegen自动生成,不手动修改"/>38 <filteritem type="filepath" name="harmony/imageRotate/src/main/ets/generated/**/*" desc="codegen自动生成,不手动修改"/>
37 <filteritem type="filename" name=".npmignore" desc="工程配置文件,不手动修改"/>39 <filteritem type="filename" name=".npmignore" desc="工程配置文件,不手动修改"/>
38 <filteritem type="filepath" name="buildEnv.sh" desc="构建环境脚本,不添加版权头"/>40 <filteritem type="filepath" name="buildEnv.sh" desc="构建环境脚本,不添加版权头"/>
41+ <filteritem type="filepath" name="jest/**/*" desc="jest测试配置及测试用例,不添加版权头"/>
42+ <filteritem type="filepath" name="example/**/*" desc="示例代码,不添加版权头"/>
39 </filefilter>43 </filefilter>
40 44 
41 <filefilter name="binaryFileTypePolicyFilter" desc="Filters for copyright header policies">45 <filefilter name="binaryFileTypePolicyFilter" desc="Filters for copyright header policies">
42 <filteritem type="filepath" name="harmony/imageRotate.har" desc="项目打包文件"/>46 <filteritem type="filepath" name="harmony/imageRotate.har" desc="项目打包文件"/>
43- </filefilter>47+ <filteritem type="filename" name="icon.png" desc="应用图标"/>
48+ <filteritem type="filename" name="app_icon.png" desc="应用图标"/>
49+ <filteritem type="filename" name="example/harmony/imageRotate/src/main/ets/assets/**/*" desc="示例资源文件"/>
44 </filefilterlist>50 </filefilterlist>
45 </oatconfig>51 </oatconfig>
46</configuration>52</configuration>
MREADME.md+25-21
@@ -4,13 +4,15 @@
4 <h1 align="center"> <code>react-native-image-rotate</code> </h1>4 <h1 align="center"> <code>react-native-image-rotate</code> </h1>
5</p>5</p>
6 6 
7+[English](./README_en.md) | **简体中文**
cpf-manager
cpf-managercpf-manager6 minutes ago

【AI-Review】【一般】【编码规范】【其他编码规范】 ● 问题: README.md 第 7 行新增的语言切换入口 [English](./README_en.md) | **简体中文** 将根目录 README.md 显式标注为简体中文版本。按照文档语言规范,根目录 README.md 和文档默认首页必须为英文,不得将中文设为默认入口。当前 README.md 全文为中文,README_en.md 才是英文版本,默认入口与规范要求相反。

● 影响: 国际用户从 npm 或代码仓库进入项目时,默认看到中文 README,需手动寻找英文切换链接,降低项目的国际可访问性。

● 建议: 交换两个文件的角色——将当前 README_en.md 的英文内容作为根目录 README.md,将当前中文 README 重命名为 README_zh.md(或 README_cn.md),并相应更新两处语言切换链接。

likedislike
8+ 
7本项目基于 [react-native-image-rotate](https://github.com/dgladkov/react-native-image-rotate) 开发。9本项目基于 [react-native-image-rotate](https://github.com/dgladkov/react-native-image-rotate) 开发。
8 10 
9-该第三方库的仓库已迁移至 GitCode,且支持直接从 npm 下载,新的包名为:`@react-native-ohos/react-native-image-rotate`,版本所属关系如下:11+该第三方库的仓库已迁移至 AtomGit,且支持直接从 npm 下载,新的包名为:`@react-native-ohos/react-native-image-rotate`,版本所属关系如下:
10 12 
11-| 三方库名称 | 三方库版本(npm地址) | 发布信息 | 支持RN版本 | Autolink | 编译API版本 | 社区基线版本 | 源码地址 |13+| 三方库名称 | 三方库版本(npm地址) | 发布信息 | 支持RN版本 | Autolink | 编译API版本 | 社区基线版本 | 源码地址 |
12-| ------------ | ------------ | ------------------------------ | ------------- | ------------- |------------------------ | ------------- | ------------- |14+| --- | --- | --- | --- | --- | --- | --- | --- |
13-| @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.2.0](https://www.npmjs.com/package/@react-native-ohos/react-native-image-rotate) | [AtomGit Releases](https://atomgit.com/CPF-RN/rntpc_react-native-image-rotate/releases) | 0.77.* | 否 | API12+ | 2.1.0 | [br_rnoh0.77](https://atomgit.com/CPF-RN/rntpc_react-native-image-rotate/tree/br_rnoh0.77) |
14 16 
15## 简介17## 简介
16 18 
@@ -35,21 +37,19 @@ yarn add @react-native-ohos/react-native-image-rotate
35 37 
36## Link38## Link
37 39 
38-| 版本 | 是否支持autolink | RN框架版本 |40+| | 是否支持Autolink | RN框架版本 |
39|--------------------------------------|----------------|-----------|41|--------------------------------------|----------------|-----------|
40-| ~2.2.0 | 否 | 0.77.* |42+| ~ 2.2.0 | 否 | 0.77.* |
41 43 
42-使用AutoLink的工程需要根据该文档配置,Autolink框架指导文档:https://gitcode.com/CPF-RN/ohos_react_native/blob/main/docs/zh-cn/02-开发/02-开发指南/Autolinking.md44+ManualLink: 此步骤为手动配置原生依赖项的指导
43 45 
44-ManualLink: 此步骤为手动配置原生依赖项的指导。46+首先需要使用 DevEco Studio 打开项目里的 OpenHarmony 工程 `harmony`。
45- 
46-首先需要使用 DevEco Studio 打开项目里的 HarmonyOS 工程 `harmony`。
47 47 
48### 1. Overrides RN SDK48### 1. Overrides RN SDK
49 49 
50为了让工程依赖同一个版本的 RN SDK,需要在工程根目录的 `oh-package.json5` 添加 overrides 字段,指向工程需要使用的 RN SDK 版本。替换的版本既可以是一个具体的版本号,也可以是一个模糊版本,还可以是本地存在的 HAR 包或源码目录。50为了让工程依赖同一个版本的 RN SDK,需要在工程根目录的 `oh-package.json5` 添加 overrides 字段,指向工程需要使用的 RN SDK 版本。替换的版本既可以是一个具体的版本号,也可以是一个模糊版本,还可以是本地存在的 HAR 包或源码目录。
51 51 
52-关于该字段的作用请阅读[官方说明](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/ide-oh-package-json5-V5#zh-cn_topic_0000001792256137_overrides)52+关于该字段的作用请阅读[官方说明](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/ide-oh-package-json5-V5#zh-cn_topic_0000001792256137_overrides)。
53 53 
54```json54```json
55{55{
@@ -65,14 +65,14 @@ ManualLink: 此步骤为手动配置原生依赖项的指导。
65 65 
66目前有两种方法:66目前有两种方法:
67 67 
68-- 通过 har 包引入;68+- 通过 har 包引入。
69- 直接链接源码。69- 直接链接源码。
70 70 
71方法一:通过 har 包引入(推荐)71方法一:通过 har 包引入(推荐)
72 72 
73> [!TIP] har 包位于三方库安装路径的 `harmony` 文件夹下。73> [!TIP] har 包位于三方库安装路径的 `harmony` 文件夹下。
74 74 
75-打开 `entry/oh-package.json5`,添加以下依赖75+打开 `entry/oh-package.json5`,添加以下依赖:
76 76 
77```json77```json
78"dependencies": {78"dependencies": {
@@ -91,7 +91,7 @@ ohpm install
91 91 
92方法二:直接链接源码92方法二:直接链接源码
93 93 
94-> [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](https://gitcode.com/CPF-RN/usage-docs/blob/master/zh-cn/link-source-code.md)94+> [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](https://atomgit.com/CPF-RN/usage-docs/blob/master/zh-cn/link-source-code.md)。
95 95 
96### 3. 配置 CMakeLists 和引入 ImageRotatePackage96### 3. 配置 CMakeLists 和引入 ImageRotatePackage
97 97 
@@ -152,7 +152,7 @@ std::vector<std::shared_ptr<Package>> PackageProvider::getPackages(Package::Cont
152 152 
153### 4. 在 ArkTs 侧引入 RNImageRotatePackage153### 4. 在 ArkTs 侧引入 RNImageRotatePackage
154 154 
155-打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加:155+打开 `entry/src/main/ets/RNPackagesFactory.ets`,添加:
156 156 
157```diff157```diff
158 ...158 ...
@@ -204,9 +204,10 @@ requestPermissions: [
204 204 
205### 编译运行API要求205### 编译运行API要求
206 206 
207-> [!TIP] 当前三方库所有版本均已实现版本隔离,支持在 `API12+` 工程编译,及 `API12+` ROM运行。207+> [!TIP] 当前三方库所有版本均已实现版本隔离,支持在 `API12+` 工程编译,及 `API12+` ROM 运行。
208 208 
209## 使用示例209## 使用示例
210+ 
210下面的代码展示了这个库的基本使用场景:211下面的代码展示了这个库的基本使用场景:
211 212 
212> [!WARNING] 使用时 import 的库名不变。213> [!WARNING] 使用时 import 的库名不变。
@@ -325,21 +326,24 @@ ImageRotate.rotateImage(
325 326 
326## 接口说明327## 接口说明
327 328 
328-> [!TIP] "Platform"列表示该属性在原三方库上支持的平台。329+> [!TIP] "平台"列表示该属性在原三方库上支持的平台。
329 330 
330-> [!TIP] "OpenHarmony Support"列为 yes 表示 OpenHarmony平台支持 该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。331+> [!TIP] "OpenHarmony平台支持"列为 "是" 表示 OpenHarmony 平台支持该属性;"否" 则表示不支持;"部分支持" 表示仅实现了功能的一部分。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
331 332 
332### API333### API
334+ 
333| 名称 | 类型 | 参数类型 | 返回值 | 必填 | 平台 | OpenHarmony平台支持 | 描述 |335| 名称 | 类型 | 参数类型 | 返回值 | 必填 | 平台 | OpenHarmony平台支持 | 描述 |
334|--------|---------|-----|-------|-------|--------|-----|-----------------|336|--------|---------|-----|-------|-------|--------|-----|-----------------|
335-| rotateImage | function | uri: string, angle: number, success: (uri: string) => void, failure: (error: Object) => void | void | no | iOS/Android | Yes | 旋转图片。仅支持 90 的倍数角度,负角度表示逆时针旋转;成功回调返回旋转后图片的 URI,失败回调返回错误信息。|337+| rotateImage | function | uri: string, angle: number, success: (uri: string) => void, failure: (error: Object) => void | void | no | iOS/Android | 是 | 旋转图片。仅支持 90 的倍数角度,负角度表示逆时针旋转;成功回调返回旋转后图片的 URI,失败回调返回错误信息。|
336 338 
337## 遗留问题339## 遗留问题
338 340 
339## 其他341## 其他
342+ 
340无343无
341 344 
342## 目录结构345## 目录结构
346+ 
343```347```
344/rntpc_react-native-image-rotate # 项目根目录348/rntpc_react-native-image-rotate # 项目根目录
345├── harmony # 鸿蒙适配代码349├── harmony # 鸿蒙适配代码
@@ -359,8 +363,8 @@ ImageRotate.rotateImage(
359 363 
360## 贡献代码364## 贡献代码
361 365 
362-使用过程中发现任何问题都可以提交 [Issue](https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/issues),当然,也非常欢迎提交 [PR](https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/pulls) 。366+使用过程中发现任何问题都可以提交 [Issue](https://atomgit.com/CPF-RN/rntpc_react-native-image-rotate/issues),当然,也非常欢迎提交 [PR](https://atomgit.com/CPF-RN/rntpc_react-native-image-rotate/pulls)。
363 367 
364## 开源协议368## 开源协议
365 369 
366-本项目基于 [The MIT License (MIT)](https://github.com/dgladkov/react-native-image-rotate/blob/master/LICENSE) ,请自由地享受和参与开源。370+本项目基于 [The MIT License (MIT)](https://github.com/dgladkov/react-native-image-rotate/blob/master/LICENSE),请自由地享受和参与开源。
@@ -4,13 +4,15 @@
4 <h1 align="center"> <code>react-native-image-rotate</code> </h1>4 <h1 align="center"> <code>react-native-image-rotate</code> </h1>
5</p>5</p>
6 6 
7+**English** | [简体中文](./README.md)
8+ 
7This project is based on [react-native-image-rotate](https://github.com/dgladkov/react-native-image-rotate).9This project is based on [react-native-image-rotate](https://github.com/dgladkov/react-native-image-rotate).
8 10 
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:11+This third-party library has been migrated to AtomGit 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 12 
11| Name | Version(Npm Address) | Release Information | Supported RN Version | Supported Autolink | Compile API Version | Community Baseline Version | Source code address |13| Name | Version(Npm Address) | Release Information | Supported RN Version | Supported Autolink | Compile API Version | Community Baseline Version | Source code address |
12-| --------------| -------------- | ------------------------------ | ------------- | ------------- |------------------------ | ------------ | ------------- |14+| --- | --- | --- | --- | --- | --- | --- | --- |
13-| @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.2.0](https://www.npmjs.com/package/@react-native-ohos/react-native-image-rotate) | [AtomGit Releases](https://atomgit.com/CPF-RN/rntpc_react-native-image-rotate/releases) | 0.77.* | No | API12+ | 2.1.0 | [br_rnoh0.77](https://atomgit.com/CPF-RN/rntpc_react-native-image-rotate/tree/br_rnoh0.77) |
14 16 
15## Introduction17## Introduction
16 18 
@@ -35,11 +37,9 @@ yarn add @react-native-ohos/react-native-image-rotate
35 37 
36## Link38## Link
37 39 
38-| Version | Supported Autolink | Supported RN Version |40+| | Supported Autolink | Supported RN Version |
39|--------------------------------------|--------------------|----------------------|41|--------------------------------------|--------------------|----------------------|
40-| ~2.2.0 | No | 0.77.* |42+| ~ 2.2.0 | No | 0.77.* |
41- 
42-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
43 43 
44ManualLink: This step provides guidance for manually configuring native dependencies.44ManualLink: This step provides guidance for manually configuring native dependencies.
45 45 
@@ -72,7 +72,7 @@ Method 1 (recommended): Use the HAR file.
72 72 
73> [!TIP] The HAR file is stored in the `harmony` directory in the installation path of the third-party library.73> [!TIP] The HAR file is stored in the `harmony` directory in the installation path of the third-party library.
74 74 
75-Open entry/oh-package.json5 file and add the following dependencies:75+Open `entry/oh-package.json5` file and add the following dependencies:
76 76 
77```json77```json
78"dependencies": {78"dependencies": {
@@ -91,7 +91,7 @@ ohpm install
91 91 
92Method 2: Directly link to the source code.92Method 2: Directly link to the source code.
93 93 
94-> [!TIP] For details, see [Directly Linking Source Code](https://gitcode.com/CPF-RN/usage-docs/blob/master/en/link-source-code.md)94+> [!TIP] For details, see [Directly Linking Source Code](https://atomgit.com/CPF-RN/usage-docs/blob/master/en/link-source-code.md).
95 95 
96### 3. Configuring CMakeLists and Introducing ImageRotatePackage96### 3. Configuring CMakeLists and Introducing ImageRotatePackage
97 97 
@@ -152,7 +152,7 @@ std::vector<std::shared_ptr<Package>> PackageProvider::getPackages(Package::Cont
152 152 
153### 4. Introducing RNImageRotatePackage to ArkTS153### 4. Introducing RNImageRotatePackage to ArkTS
154 154 
155-Open the entry/src/main/ets/RNPackagesFactory.ts file and add the following code:155+Open `entry/src/main/ets/RNPackagesFactory.ets` and add:
156 156 
157```diff157```diff
158 ...158 ...
@@ -326,11 +326,12 @@ ImageRotate.rotateImage(
326 326 
327## Available APIs327## Available APIs
328 328 
329-> [!TIP] The **Platform** column indicates the platform where the properties are supported in the original third-party library.329+> [!TIP] The "Platform" column indicates the platform where the properties are supported in the original third-party library.
330 330 
331-> [!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.331+> [!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.
332 332 
333### API333### API
334+ 
334| Name | Type | Parameter Type | Return Value | Required | Platform | OpenHarmony Platform Support | Description |335| Name | Type | Parameter Type | Return Value | Required | Platform | OpenHarmony Platform Support | Description |
335|--------|---------|-----|-------|-------|--------|-----|-----------------|336|--------|---------|-----|-------|-------|--------|-----|-----------------|
336| 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.|337| 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.|
@@ -338,9 +339,11 @@ ImageRotate.rotateImage(
338## Known Issues339## Known Issues
339 340 
340## Other341## Other
342+ 
341None343None
342 344 
343## Directory Structure345## Directory Structure
346+ 
344```347```
345/rntpc_react-native-image-rotate # Project root directory348/rntpc_react-native-image-rotate # Project root directory
346├── harmony # HarmonyOS adaptation code349├── harmony # HarmonyOS adaptation code
@@ -360,7 +363,7 @@ None
360 363 
361## How to Contribute364## How to Contribute
362 365 
363-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).366+If you find any problem when using react-native-image-rotate, submit an [issue](https://atomgit.com/CPF-RN/rntpc_react-native-image-rotate/issues) or a [PR](https://atomgit.com/CPF-RN/rntpc_react-native-image-rotate/pulls).
364 367 
365## License368## License
366 369 
@@ -1,190 +0,0 @@
1-import React, { Component } from 'react';
2-import {
3- Image,
4- StyleSheet,
5- Text,
6- View,
7- TouchableOpacity,
8- TextInput,
9-} from 'react-native';
10-import{
11- Tester,
12- TestSuite,
13- TestCase,
14-} from '@rnoh/testerino';
15- 
16-import ImageRotate from "react-native-image-rotate";
17- 
18-const SOURCE_IMAGE = 'https://filesamples.com/samples/image/jpg/sample_640×426.jpg';
19-const INVALID_IMAGE_URI = 'file:///invalid/path/not_a_real_image.jpg';
20- 
21-type ErrorTestState = {
22- error: string | null;
23-};
24- 
25-const waitForNativeCallback = (ms: number = 3000) =>
26- new Promise<void>((resolve) => setTimeout(resolve, ms));
27- 
28-class App extends Component {
29- 
30- constructor() {
31- super();
32- this.state = {
33- image: SOURCE_IMAGE,
34- currentAngle: 0,
35- width: 150,
36- height: 240,
37- };
38- 
39- this.rotate = this.rotate.bind(this);
40- }
41- 
42- rotate(angle) {
43- const nextAngle = this.state.currentAngle + angle;
44- ImageRotate.rotateImage(
45- SOURCE_IMAGE,
46- nextAngle,
47- (uri) => {
48- this.setState({
49- image: uri,
50- currentAngle: nextAngle,
51- width: this.state.height,
52- height: this.state.width,
53- });
54- },
55- (error) => {
56- console.error(error);
57- }
58- );
59- }
60- 
61- render() {
62- return (
63- <Tester style = {styles.container}>
64- <TestSuite name = "imageRotateTest">
65- <Text>{""}</Text>
66- 
67- <TextInput>
68- {}
69- </TextInput>
70- 
71- <TestCase
72- itShould = "native rotate CW"
73- tags = {['C_API']}
74- initialState = {undefined as any}
75- arrange = {({setState}) => {
76- return (
77- <TouchableOpacity
78- onPress = {() => {
79- this.rotate(90);
80- setState(true);
81- }}
82- style = {styles.btn}>
83- <Text style = {styles.btnText} > 图片顺旋转 </Text>
84- </TouchableOpacity>
85- );
86- }}
87- assert = {async ({expect, state}) => {
88- expect((state as Buffer)).to.be.true;
89- }}
90- />
91- <TestCase
92- itShould = "native rotate CCW"
93- tags = {['C_API']}
94- initialState = {undefined as any}
95- arrange = {({setState}) => {
96- return (
97- <TouchableOpacity
98- onPress = {() => {
99- this.rotate(-90);
100- setState(true);
101- }}
102- style = {styles.btn}>
103- <Text style = {styles.btnText} > 图片逆旋转 </Text>
104- </TouchableOpacity>
105- );
106- }}
107- assert = {async ({expect, state}) => {
108- expect((state as Buffer)).to.be.true;
109- }}
110- />
111- <TestCase
112- itShould = "failure callback when PixelMap decode fails"
113- tags = {['C_API']}
114- initialState = {{ error: null } as ErrorTestState}
115- arrange = {({setState}) => {
116- return (
117- <TouchableOpacity
118- onPress = {() => {
119- ImageRotate.rotateImage(
120- INVALID_IMAGE_URI,
121- 90,
122- () => {
123- setState({ error: '__success_unexpected__' });
124- },
125- (error) => {
126- setState({ error: String(error) });
127- },
128- );
129- }}
130- style = {styles.btn}>
131- <Text style = {styles.btnText}> 测试 PixelMap 解码失败 </Text>
132- </TouchableOpacity>
133- );
134- }}
135- assert = {async ({expect, state}) => {
136- await waitForNativeCallback();
137- const { error } = state as ErrorTestState;
138- expect(error).to.not.be.null;
139- expect(error).to.contain('Cannot open bitmap');
140- }}
141- />
142- </TestSuite>
143- <View style={styles.imageContainer}>
144- <Image style={{width: this.state.width, height: this.state.height}} resizeMode="contain" source={{uri: this.state.image}} />
145- </View>
146- </Tester>
147- );
148- }
149-}
150- 
151-const styles = StyleSheet.create({
152- container: {
153- flex: 1,
154- justifyContent: 'center',
155- alignItems: 'center',
156- },
157- imageContainer: {
158- height: 240,
159- justifyContent: 'center',
160- },
161- btn: {
162- alignItems: 'center',
163- justifyContent: 'center',
164- backgroundColor: 'blue',
165- padding: 10,
166- borderRadius: 5,
167- },
168- btnText: {
169- color: 'white',
170- fontSize: 16,
171-},
172-});
173- 
174- 
175-export const displayName = 'react-native-image-rotate';
176-export const framework = 'React';
177-export const category = 'UI';
178-export const title = 'react-native-image-rotate';
179-export const documentationURL = 'https://github.com/react-native-oh-library/RNOHDCS/tree/main/react-native-image-rotate';
180-export const description = 'React Native image rotate';
181-export const examples = [
182- {
183- title: 'React Native image rotate',
184- render: function (): any {
185- return <App />;
186- },
187- },
188- ];
189- 
190-export default App;
@@ -6,6 +6,6 @@
6 6 
7import {AppRegistry} from 'react-native';7import {AppRegistry} from 'react-native';
8import {name as appName} from './app.json';8import {name as appName} from './app.json';
9-import App from './App';9+import App from './src/Home';
10 10 
11AppRegistry.registerComponent(appName, () => App);11AppRegistry.registerComponent(appName, () => App);
@@ -8,7 +8,7 @@
8 "start": "hdc rport tcp:8081 tcp:8081 && react-native start",8 "start": "hdc rport tcp:8081 tcp:8081 && react-native start",
9 "codegen": "react-native codegen-harmony --cpp-output-path ./harmony/entry/src/main/cpp/generated --rnoh-module-path ./harmony/entry/oh_modules/@rnoh/react-native-openharmony",9 "codegen": "react-native codegen-harmony --cpp-output-path ./harmony/entry/src/main/cpp/generated --rnoh-module-path ./harmony/entry/oh_modules/@rnoh/react-native-openharmony",
10 "pack:pkg": "cd ../ && npm pack && cd ./example",10 "pack:pkg": "cd ../ && npm pack && cd ./example",
11- "install:pkg": "npm uninstall @react-native-ohos/react-native-image-rotate && npm run pack:pkg && npm i @react-native-ohos/react-native-image-rotate@file:../react-native-ohos-react-native-image-rotate-2.2.1-beta.1.tgz",11+ "install:pkg": "npm uninstall @react-native-ohos/react-native-image-rotate && npm run pack:pkg && npm i @react-native-ohos/react-native-image-rotate@file:../react-native-ohos-react-native-image-rotate-2.2.1-beta.2.tgz",
12 "dev": "npm run codegen && react-native bundle-harmony --dev --minify=false",12 "dev": "npm run codegen && react-native bundle-harmony --dev --minify=false",
13 "prod": "npm run codegen && react-native bundle-harmony --dev=false --minify=true",13 "prod": "npm run codegen && react-native bundle-harmony --dev=false --minify=true",
14 "postinstall": "node ./scripts/create-build-profile",14 "postinstall": "node ./scripts/create-build-profile",
@@ -16,7 +16,7 @@
16 },16 },
17 "dependencies": {17 "dependencies": {
18 "@gorhom/portal": "^1.0.14",18 "@gorhom/portal": "^1.0.14",
19- "@react-native-ohos/react-native-image-rotate": "file:../react-native-ohos-react-native-image-rotate-2.2.1-beta.1.tgz",19+ "@react-native-ohos/react-native-image-rotate": "file:../react-native-ohos-react-native-image-rotate-2.2.1-beta.2.tgz",
20 "@react-native-oh/react-native-harmony": "0.77.72",20 "@react-native-oh/react-native-harmony": "0.77.72",
21 "@rnoh/testerino": "npm:@react-native-oh-tpl/testerino@0.0.9",21 "@rnoh/testerino": "npm:@react-native-oh-tpl/testerino@0.0.9",
22 "react": "18.3.1",22 "react": "18.3.1",
@@ -0,0 +1,95 @@
1+import React, {useState} from 'react';
2+import {StatusBar, StyleSheet, Text, TouchableOpacity, View} from 'react-native';
3+import UpstreamDemo from './index';
4+import HarmonyDemo from './harmonyTestDemo';
5+ 
6+export default function Home() {
7+ const [screen, setScreen] = useState('home');
8+ 
9+ if (screen === 'upstream') {
10+ return (
11+ <View style={styles.screen}>
12+ <TouchableOpacity
13+ style={styles.backButton}
14+ onPress={() => setScreen('home')}>
15+ <Text style={styles.backText}>返回首页</Text>
16+ </TouchableOpacity>
17+ <UpstreamDemo />
18+ </View>
19+ );
20+ }
21+ 
22+ if (screen === 'harmony') {
23+ return (
24+ <View style={styles.screen}>
25+ <TouchableOpacity
26+ style={styles.backButton}
27+ onPress={() => setScreen('home')}>
28+ <Text style={styles.backText}>返回首页</Text>
29+ </TouchableOpacity>
30+ <HarmonyDemo />
31+ </View>
32+ );
33+ }
34+ 
35+ return (
36+ <View style={styles.container}>
37+ <Text style={styles.title}>react-native-image-rotate Demo</Text>
38+ <TouchableOpacity
39+ style={styles.button}
40+ onPress={() => setScreen('upstream')}>
41+ <Text style={styles.buttonText}>上游demo</Text>
42+ </TouchableOpacity>
43+ <TouchableOpacity
44+ style={styles.button}
45+ onPress={() => setScreen('harmony')}>
46+ <Text style={styles.buttonText}>鸿蒙demo</Text>
47+ </TouchableOpacity>
48+ </View>
49+ );
50+}
51+ 
52+const styles = StyleSheet.create({
53+ screen: {
54+ flex: 1,
55+ backgroundColor: '#F5FCFF',
56+ },
57+ container: {
58+ flex: 1,
59+ justifyContent: 'center',
60+ alignItems: 'center',
61+ backgroundColor: '#F5FCFF',
62+ },
63+ title: {
64+ fontSize: 20,
65+ textAlign: 'center',
66+ margin: 10,
67+ },
68+ button: {
69+ padding: 10,
70+ margin: 10,
71+ minWidth: 160,
72+ borderWidth: 1,
73+ borderColor: 'white',
74+ borderRadius: 5,
75+ backgroundColor: 'grey',
76+ alignItems: 'center',
77+ },
78+ buttonText: {
79+ color: '#ffffff',
80+ fontSize: 16,
81+ },
82+ backButton: {
83+ padding: 8,
84+ margin: 8,
85+ marginTop: (StatusBar.currentHeight || 0) + 12,
86+ alignSelf: 'flex-start',
87+ borderWidth: 1,
88+ borderColor: 'white',
89+ borderRadius: 3,
90+ backgroundColor: 'grey',
91+ },
92+ backText: {
93+ color: '#ffffff',
94+ },
95+});
@@ -0,0 +1,389 @@
1+import React, { Component } from 'react';
2+import {
3+ Image,
4+ StyleSheet,
5+ Text,
6+ View,
7+ TouchableOpacity,
8+ ScrollView,
9+ SafeAreaView,
10+ StatusBar,
11+} from 'react-native';
12+import{
13+ Tester,
14+ TestSuite,
15+ TestCase,
16+} from '@rnoh/testerino';
17+ 
18+import ImageRotate from "react-native-image-rotate";
19+ 
20+const SOURCE_IMAGE = 'https://filesamples.com/samples/image/jpg/sample_640×426.jpg';
cpf-manager
cpf-managercpf-manager21 hours ago

【AI-Review】【一般】【基础代码问题】【字符串问题】 ● 问题: SOURCE_IMAGE 常量的 URL 为 https://filesamples.com/samples/image/jpg/sample_640×426.jpg,其中 640 与 426 之间的分隔符是 Unicode 乘号 ×(U+00D7,UTF-8 编码 C3 97),不是 ASCII 字母 x。该 URL 会被传入原生模块的 getPixelMapFromURL,经 normalizeRemoteRequestUrl 处理后,encodeURI(decodeURI(src)) 会将 × 编码为 %C3%97,最终 HTTP 请求目标变为 sample_640%C3%97426.jpg。如果服务器上实际文件名使用的是 ASCII x(即 sample_640x426.jpg),请求会返回 404。

● 影响: 鸿蒙 Demo 中三个主要旋转测试用例(rotateImage_cw、rotateImage_ccw、rotateImage_angle_45)都使用 SOURCE_IMAGE 作为输入。如果 URL 因字符问题导致 404,这三个测试用例的 assert 会因 uri 未设置或包含 __failure__ 而失败,Demo 无法正常验证旋转功能。

● 建议: 将 ×(U+00D7)改为 ASCII x(U+0078),即 sample_640x426.jpg。修改后在浏览器或 curl 中验证该 URL 可正常返回图片,再提交。

likedislike
yanPeng
yanPeng
7 hours ago Comments:
likedislike
21+const INVALID_IMAGE_URI = 'file:///invalid/path/not_a_real_image.jpg';
22+// 不存在的图片地址:HTTP 非 200 或传输失败都会走 failure 回调
23+const NETWORK_FAIL_URI = 'https://example.com/rn-image-rotate-not-exist-404.jpg';
24+ 
25+// 正方形预览区:横图/竖图(±90°)都按最长边等比缩放,视觉大小一致
26+const PREVIEW_SIZE = 220;
27+const BTN_WIDTH = 240;
28+ 
29+type UriTestState = {
30+ uri: string | null;
31+};
32+ 
33+type ErrorTestState = {
34+ error: string | null;
35+};
36+ 
37+const waitForNativeCallback = (ms: number = 3000) =>
38+ new Promise<void>((resolve) => setTimeout(resolve, ms));
39+ 
40+class App extends Component {
41+ 
42+ constructor() {
43+ super();
44+ this.state = {
45+ image: SOURCE_IMAGE,
46+ currentAngle: 0,
47+ };
48+ }
49+ 
50+ render() {
51+ return (
52+ <SafeAreaView style={styles.safeArea}>
53+ <StatusBar barStyle="dark-content" translucent={false} />
54+ <ScrollView
55+ style={styles.scroll}
56+ contentContainerStyle={styles.scrollContent}
57+ keyboardShouldPersistTaps="handled"
58+ >
59+ <Tester style = {styles.container}>
60+ <TestSuite name = "imageRotateTest">
61+ <TestCase
62+ key = "rotateImage_cw"
63+ itShould = "native rotate CW"
64+ tags = {['C_API']}
65+ initialState = {{ uri: null } as UriTestState}
66+ arrange = {({setState}) => {
67+ return (
68+ <View style={styles.caseWrap}>
69+ <TouchableOpacity
70+ onPress = {() => {
71+ ImageRotate.rotateImage(
72+ SOURCE_IMAGE,
73+ 90,
74+ (uri) => {
75+ this.setState({
76+ image: uri,
77+ currentAngle: 90,
78+ });
79+ setState({ uri });
80+ },
81+ (error) => {
82+ setState({ uri: '__failure__' });
83+ console.error(error);
84+ },
85+ );
86+ }}
87+ style = {styles.btn}>
88+ <Text style = {styles.btnText} numberOfLines={1}> 图片顺旋转 </Text>
89+ </TouchableOpacity>
90+ </View>
91+ );
92+ }}
93+ assert = {async ({expect, state}) => {
94+ await waitForNativeCallback();
95+ const { uri } = state as UriTestState;
96+ expect(uri).to.not.be.null;
97+ expect(uri).to.be.a('string').that.is.not.empty;
98+ expect(uri).to.not.contain('__failure__');
99+ }}
100+ />
101+ <TestCase
102+ key = "rotateImage_ccw"
103+ itShould = "native rotate CCW"
104+ tags = {['C_API']}
105+ initialState = {{ uri: null } as UriTestState}
106+ arrange = {({setState}) => {
107+ return (
108+ <View style={styles.caseWrap}>
109+ <TouchableOpacity
110+ onPress = {() => {
111+ ImageRotate.rotateImage(
112+ SOURCE_IMAGE,
113+ -90,
114+ (uri) => {
115+ this.setState({
116+ image: uri,
117+ currentAngle: -90,
118+ });
119+ setState({ uri });
120+ },
121+ (error) => {
122+ setState({ uri: '__failure__' });
123+ console.error(error);
124+ },
125+ );
126+ }}
127+ style = {styles.btn}>
128+ <Text style = {styles.btnText} numberOfLines={1}> 图片逆旋转 </Text>
129+ </TouchableOpacity>
130+ </View>
131+ );
132+ }}
133+ assert = {async ({expect, state}) => {
134+ await waitForNativeCallback();
135+ const { uri } = state as UriTestState;
136+ expect(uri).to.not.be.null;
137+ expect(uri).to.be.a('string').that.is.not.empty;
138+ expect(uri).to.not.contain('__failure__');
139+ }}
140+ />
141+ <TestCase
142+ key = "rotateImage_decode_fail"
143+ itShould = "failure callback when PixelMap decode fails"
144+ tags = {['C_API']}
145+ initialState = {{ error: null } as ErrorTestState}
146+ arrange = {({setState}) => {
147+ return (
148+ <View style={styles.caseWrap}>
149+ <TouchableOpacity
150+ onPress = {() => {
151+ ImageRotate.rotateImage(
152+ INVALID_IMAGE_URI,
153+ 90,
154+ () => {
155+ setState({ error: '__success_unexpected__' });
156+ },
157+ (error) => {
158+ setState({ error: String(error) });
159+ },
160+ );
161+ }}
162+ style = {styles.btn}>
163+ <Text style = {styles.btnText} numberOfLines={1}> 测试 PixelMap 解码失败 </Text>
164+ </TouchableOpacity>
165+ </View>
166+ );
167+ }}
168+ assert = {async ({expect, state}) => {
169+ await waitForNativeCallback();
170+ const { error } = state as ErrorTestState;
171+ expect(error).to.not.be.null;
172+ expect(error).to.contain('Cannot open bitmap');
173+ }}
174+ />
175+ <TestCase
176+ key = "rotateImage_empty_uri"
177+ itShould = "throw when URI is empty string"
178+ tags = {['C_API']}
179+ initialState = {{ error: null } as ErrorTestState}
180+ arrange = {({setState}) => {
181+ return (
182+ <View style={styles.caseWrap}>
183+ <TouchableOpacity
184+ onPress = {() => {
185+ try {
186+ ImageRotate.rotateImage(
187+ '',
188+ 90,
189+ () => {
190+ setState({ error: '__success_unexpected__' });
191+ },
192+ (error) => {
193+ setState({ error: String(error) });
194+ },
195+ );
196+ } catch (e) {
197+ setState({ error: String(e) });
198+ }
199+ }}
200+ style = {styles.btn}>
201+ <Text style = {styles.btnText} numberOfLines={1}> 测试空 URI </Text>
202+ </TouchableOpacity>
203+ </View>
204+ );
205+ }}
206+ assert = {async ({expect, state}) => {
207+ await waitForNativeCallback(500);
208+ const { error } = state as ErrorTestState;
209+ expect(error).to.not.be.null;
210+ expect(error).to.contain('Please specify a URI');
211+ }}
212+ />
213+ <TestCase
214+ key = "rotateImage_null_uri"
215+ itShould = "throw when URI is null"
216+ tags = {['C_API']}
217+ initialState = {{ error: null } as ErrorTestState}
218+ arrange = {({setState}) => {
219+ return (
220+ <View style={styles.caseWrap}>
221+ <TouchableOpacity
222+ onPress = {() => {
223+ try {
224+ ImageRotate.rotateImage(
225+ null as any,
226+ 90,
227+ () => {
228+ setState({ error: '__success_unexpected__' });
229+ },
230+ (error) => {
231+ setState({ error: String(error) });
232+ },
233+ );
234+ } catch (e) {
235+ setState({ error: String(e) });
236+ }
237+ }}
238+ style = {styles.btn}>
239+ <Text style = {styles.btnText} numberOfLines={1}> 测试 null URI </Text>
240+ </TouchableOpacity>
241+ </View>
242+ );
243+ }}
244+ assert = {async ({expect, state}) => {
245+ await waitForNativeCallback(500);
246+ const { error } = state as ErrorTestState;
247+ expect(error).to.not.be.null;
248+ expect(error).to.contain('Please specify a URI');
249+ }}
250+ />
251+ <TestCase
252+ key = "rotateImage_angle_45"
253+ itShould = "native rotate with non-90 multiple angle (45)"
254+ tags = {['C_API']}
255+ initialState = {{ uri: null } as UriTestState}
256+ arrange = {({setState}) => {
257+ return (
258+ <View style={styles.caseWrap}>
259+ <TouchableOpacity
260+ onPress = {() => {
261+ ImageRotate.rotateImage(
262+ SOURCE_IMAGE,
263+ 45,
264+ (uri) => {
265+ setState({ uri });
266+ },
267+ (error) => {
268+ setState({ uri: '__failure__' });
269+ console.error(error);
270+ },
271+ );
272+ }}
273+ style = {styles.btn}>
274+ <Text style = {styles.btnText} numberOfLines={1}> 测试 45° 旋转 </Text>
275+ </TouchableOpacity>
276+ </View>
277+ );
278+ }}
279+ assert = {async ({expect, state}) => {
280+ await waitForNativeCallback();
281+ const { uri } = state as UriTestState;
282+ expect(uri).to.not.be.null;
283+ expect(uri).to.be.a('string').that.is.not.empty;
284+ expect(uri).to.not.contain('__failure__');
285+ }}
286+ />
287+ <TestCase
288+ key = "rotateImage_network_fail"
289+ itShould = "failure callback when remote image download fails"
290+ tags = {['C_API']}
291+ initialState = {{ error: null } as ErrorTestState}
292+ arrange = {({setState}) => {
293+ return (
294+ <View style={styles.caseWrap}>
295+ <TouchableOpacity
296+ onPress = {() => {
297+ ImageRotate.rotateImage(
298+ NETWORK_FAIL_URI,
299+ 90,
300+ () => {
301+ setState({ error: '__success_unexpected__' });
302+ },
303+ (error) => {
304+ setState({ error: String(error) });
305+ },
306+ );
307+ }}
308+ style = {styles.btn}>
309+ <Text style = {styles.btnText} numberOfLines={1}> 测试网络下载失败 </Text>
310+ </TouchableOpacity>
311+ </View>
312+ );
313+ }}
314+ assert = {async ({expect, state}) => {
315+ await waitForNativeCallback(8000);
316+ const { error } = state as ErrorTestState;
317+ expect(error).to.not.be.null;
318+ expect(error).to.be.a('string').that.is.not.empty;
319+ // 排除误入 success;HTTP 非 200 / 传输失败都会走 failure
320+ expect(error).to.not.equal('__success_unexpected__');
321+ }}
322+ />
323+ </TestSuite>
324+ <View style={styles.imageContainer}>
325+ <Image
326+ style={styles.previewImage}
327+ resizeMode="contain"
328+ source={{uri: this.state.image}}
329+ />
330+ </View>
331+ </Tester>
332+ </ScrollView>
333+ </SafeAreaView>
334+ );
335+ }
336+}
337+ 
338+const styles = StyleSheet.create({
339+ safeArea: {
340+ flex: 1,
341+ backgroundColor: '#ffffff'
342+ },
343+ scroll: {
344+ flex: 1,
345+ },
346+ scrollContent: {
347+ flexGrow: 1,
348+ paddingBottom: 24,
349+ alignItems: 'center',
350+ },
351+ container: {
352+ width: '100%',
353+ alignSelf: 'center',
354+ alignItems: 'center',
355+ overflow: 'hidden',
356+ },
357+ caseWrap: {
358+ width: BTN_WIDTH,
359+ alignSelf: 'center',
360+ overflow: 'hidden',
361+ },
362+ imageContainer: {
363+ width: PREVIEW_SIZE,
364+ height: PREVIEW_SIZE,
365+ justifyContent: 'center',
366+ alignItems: 'center',
367+ overflow: 'hidden',
368+ },
369+ previewImage: {
370+ width: PREVIEW_SIZE,
371+ height: PREVIEW_SIZE,
372+ },
373+ btn: {
374+ width: BTN_WIDTH,
375+ alignItems: 'center',
376+ justifyContent: 'center',
377+ backgroundColor: 'blue',
378+ paddingVertical: 10,
379+ paddingHorizontal: 12,
380+ borderRadius: 5,
381+ },
382+ btnText: {
383+ color: 'white',
384+ fontSize: 16,
385+ textAlign: 'center',
386+ },
387+});
388+ 
389+export default App;
@@ -0,0 +1,95 @@
1+/**
2+ * Upstream demo from:
3+ * https://github.com/dgladkov/react-native-image-rotate/blob/master/Example/src/index.js
4+ */
5+import React, { Component } from 'react';
6+import {
7+ Image,
8+ StyleSheet,
9+ Text,
10+ TouchableHighlight,
11+ View,
12+} from 'react-native';
13+ 
14+import ImageRotate from 'react-native-image-rotate';
15+ 
16+const SOURCE_IMAGE =
17+ 'https://upload.wikimedia.org/wikipedia/en/5/56/Warcraft_Teaser_Poster.jpg';
18+ 
19+export default class App extends Component {
20+ constructor() {
21+ super();
22+ this.state = {
23+ image: SOURCE_IMAGE,
24+ currentAngle: 0,
25+ width: 150,
26+ height: 240,
27+ };
28+ 
29+ this.rotate = this.rotate.bind(this);
30+ }
31+ 
32+ rotate(angle) {
33+ const nextAngle = this.state.currentAngle + angle;
34+ ImageRotate.rotateImage(
35+ SOURCE_IMAGE,
36+ nextAngle,
37+ (uri) => {
38+ this.setState({
39+ image: uri,
40+ currentAngle: nextAngle,
41+ width: this.state.height,
42+ height: this.state.width,
43+ });
44+ },
45+ (error) => {
46+ console.error(error);
47+ },
48+ );
49+ }
50+ 
51+ render() {
52+ return (
53+ <View style={styles.container}>
54+ <View style={styles.imageContainer}>
55+ <Image
56+ style={{width: this.state.width, height: this.state.height}}
57+ source={{uri: this.state.image}}
58+ />
59+ </View>
60+ <TouchableHighlight
61+ onPress={() => this.rotate(90)}
62+ style={styles.button}>
63+ <Text style={styles.text}>ROTATE CW</Text>
64+ </TouchableHighlight>
65+ 
66+ <TouchableHighlight
67+ onPress={() => this.rotate(-90)}
68+ style={styles.button}>
69+ <Text style={styles.text}>ROTATE CCW</Text>
70+ </TouchableHighlight>
71+ </View>
72+ );
73+ }
74+}
75+ 
76+const styles = StyleSheet.create({
77+ container: {
78+ flex: 1,
79+ justifyContent: 'center',
80+ alignItems: 'center',
81+ backgroundColor: '#F5FCFF',
82+ },
83+ button: {
84+ backgroundColor: 'red',
85+ padding: 5,
86+ margin: 5,
87+ },
88+ imageContainer: {
89+ height: 240,
90+ justifyContent: 'center',
91+ },
92+ text: {
93+ color: 'white',
94+ },
95+});
@@ -6,7 +6,7 @@
6 "name": "@react-native-ohos/react-native-image-rotate",6 "name": "@react-native-ohos/react-native-image-rotate",
7 "description": "Used for rotating images in React Native applications",7 "description": "Used for rotating images in React Native applications",
8 "main": "Index.ets",8 "main": "Index.ets",
9- "version": "2.2.1-beta.1",9+ "version": "2.2.1-beta.2",
10 "dependencies": {10 "dependencies": {
11 "@rnoh/react-native-openharmony": "file:../react_native_openharmony"11 "@rnoh/react-native-openharmony": "file:../react_native_openharmony"
12 }12 }
@@ -12,20 +12,69 @@ export class RNImageRotateTurboModule extends TurboModule implements TM.ImageRot
12 12 
13 private static TEMP_FILE_PREFIX: string = "ReactNative_rotated_image_";13 private static TEMP_FILE_PREFIX: string = "ReactNative_rotated_image_";
14 private static COMPRESS_QUALITY: number = 90;14 private static COMPRESS_QUALITY: number = 90;
15+ private static remoteImageBodyCache: Map<string, ArrayBuffer> = new Map();
16+ private static readonly REMOTE_IMAGE_CACHE_MAX: number = 4;
17+ 
18+ private static cacheRemoteImageBody(key: string, body: ArrayBuffer): void {
19+ if (RNImageRotateTurboModule.remoteImageBodyCache.has(key)) {
20+ RNImageRotateTurboModule.remoteImageBodyCache.delete(key);
21+ }
22+ RNImageRotateTurboModule.remoteImageBodyCache.set(key, body);
23+ while (RNImageRotateTurboModule.remoteImageBodyCache.size > RNImageRotateTurboModule.REMOTE_IMAGE_CACHE_MAX) {
24+ const oldest = RNImageRotateTurboModule.remoteImageBodyCache.keys().next().value;
25+ if (oldest === undefined) {
26+ break;
27+ }
28+ RNImageRotateTurboModule.remoteImageBodyCache.delete(oldest);
29+ }
30+ }
31+ 
32+ private static normalizeRemoteRequestUrl(src: string): string {
33+ try {
34+ return encodeURI(decodeURI(src));
35+ } catch (err) {
36+ return encodeURI(src);
37+ }
38+ }
39+ 
40+ private static isRemoteUri(uri: string): boolean {
41+ return /^https?:\/\//i.test(uri);
42+ }
43+ 
15 constructor(protected ctx: TurboModuleContext) {44 constructor(protected ctx: TurboModuleContext) {
16 super(ctx);45 super(ctx);
17- const mcontext = this.ctx.uiAbilityContext;46+ try {
18- let cleanTask = new RNImageRotateTurboModule.CleanTask(mcontext);47+ const mcontext = this.ctx.uiAbilityContext;
19- cleanTask.cleanDirectory();48+ let cleanTask = new RNImageRotateTurboModule.CleanTask(mcontext);
49+ cleanTask.cleanDirectory();
50+ } catch (err) {
51+ console.error("RNImageRotateTurboModule cleanDirectory on init failed: " + (err as BusinessError).message);
52+ }
53+ }
54+ 
55+ __onDestroy__() {
56+ RNImageRotateTurboModule.remoteImageBodyCache.clear();
57+ try {
58+ const mcontext = this.ctx.uiAbilityContext;
59+ let cleanTask = new RNImageRotateTurboModule.CleanTask(mcontext);
60+ cleanTask.cleanDirectory();
61+ } catch (err) {
62+ console.error("RNImageRotateTurboModule cleanDirectory on destroy failed: " + (err as BusinessError).message);
63+ }
20 }64 }
21 65 
22 rotateImage(muri: string, mangle: number, success: (msuccess: string) => void, error: (merror: Object) => void) {66 rotateImage(muri: string, mangle: number, success: (msuccess: string) => void, error: (merror: Object) => void) {
23 if (muri === null || muri === "") {67 if (muri === null || muri === "") {
24 throw new Error("Please specify a URI");68 throw new Error("Please specify a URI");
25 }69 }
70+ if (typeof success !== 'function' || typeof error !== 'function') {
71+ throw new Error("Please specify success and error callbacks");
72+ }
73+ if (!Number.isFinite(mangle)) {
74+ error("Invalid angle: " + mangle);
75+ return;
76+ }
26 const mcontext = this.ctx.uiAbilityContext;77 const mcontext = this.ctx.uiAbilityContext;
27- let cleanTask = new RNImageRotateTurboModule.CleanTask(mcontext);
28- cleanTask.cleanDirectory();
29 78 
30 let rotateTask = new RNImageRotateTurboModule.RotateTask(79 let rotateTask = new RNImageRotateTurboModule.RotateTask(
31 mcontext,80 mcontext,
@@ -33,16 +82,23 @@ export class RNImageRotateTurboModule extends TurboModule implements TM.ImageRot
33 mangle,82 mangle,
34 success,83 success,
35 error);84 error);
36- rotateTask.openBitmapInputStream(rotateTask.mUri).then((imagePixelMap)=>{85+ rotateTask.openBitmapInputStream(rotateTask.mUri).then(async (imagePixelMap)=>{
37 if (imagePixelMap === undefined) {86 if (imagePixelMap === undefined) {
38 return;87 return;
39 }88 }
40- imagePixelMap.rotate(rotateTask.mAngle).then(() => {89+ try {
41- rotateTask.doInBackgroundGuarded(imagePixelMap);90+ await imagePixelMap.rotate(rotateTask.mAngle);
42- }).catch((err: BusinessError) => {91+ await rotateTask.doInBackgroundGuarded(imagePixelMap);
43- console.error(`Failed to rotate pixelmap. code is ${err.code}, message is ${err.message}`);92+ } catch (err) {
44- rotateTask.mError(err.message);93+ console.error(`Failed to rotate/pack pixelmap. code is ${(err as BusinessError).code}, message is ${(err as BusinessError).message}`);
45- });94+ rotateTask.mError((err as BusinessError).message);
95+ } finally {
96+ try {
97+ await imagePixelMap.release();
98+ } catch (releaseErr) {
99+ console.error("Failed to release pixelmap: " + (releaseErr as BusinessError).message);
100+ }
101+ }
46 }).catch((err: BusinessError) => {102 }).catch((err: BusinessError) => {
47 console.error(`Failed to open bitmap input stream. code is ${err.code}, message is ${err.message}`);103 console.error(`Failed to open bitmap input stream. code is ${err.code}, message is ${err.message}`);
48 rotateTask.mError(err.message);104 rotateTask.mError(err.message);
@@ -95,33 +151,45 @@ export class RNImageRotateTurboModule extends TurboModule implements TM.ImageRot
95 151 
96 // 网络图片转换为PixelMap152 // 网络图片转换为PixelMap
97 private async getPixelMapFromURL(src: string): Promise<image.PixelMap> {153 private async getPixelMapFromURL(src: string): Promise<image.PixelMap> {
98- const httpRequest = http.createHttp();154+ let imageData: ArrayBuffer | undefined = RNImageRotateTurboModule.remoteImageBodyCache.get(src);
99- try {155+ if (imageData === undefined) {
100- const data: http.HttpResponse = await httpRequest.request(src);156+ const requestUrl = RNImageRotateTurboModule.normalizeRemoteRequestUrl(src);
101- if (data.responseCode === http.ResponseCode.OK && data.result instanceof ArrayBuffer) {157+ const httpRequest = http.createHttp();
102- if (data.header.hasOwnProperty('content-type')) {158+ try {
103- this.imageType = data.header['content-type'];159+ const data: http.HttpResponse = await httpRequest.request(requestUrl, {
104- }160+ method: http.RequestMethod.GET,
105- let imageData: ArrayBuffer = data.result;161+ expectDataType: http.HttpDataType.ARRAY_BUFFER,
106- const imageSource: image.ImageSource = image.createImageSource(imageData);162+ usingProtocol: http.HttpProtocol.HTTP1_1,
107- try {163+ });
108- const imageInfo = await imageSource.getImageInfo();164+ if (data.responseCode === http.ResponseCode.OK && data.result instanceof ArrayBuffer) {
109- const imageWidth = Math.round(imageInfo.size.width);165+ if (data.header.hasOwnProperty('content-type')) {
110- const imageHeight = Math.round(imageInfo.size.height);166+ this.imageType = data.header['content-type'];
111- const option: image.InitializationOptions = {
112- 'alphaType': 0,
113- 'editable': false,
114- 'pixelFormat': 3,
115- 'scaleMode': 1,
116- 'size': { height: imageHeight, width: imageWidth },
117 }167 }
118- return await imageSource.createPixelMap(option);168+ imageData = data.result;
119- } finally {169+ RNImageRotateTurboModule.cacheRemoteImageBody(src, imageData);
120- imageSource.release();
121 }170 }
171+ } finally {
172+ httpRequest.destroy();
122 }173 }
174+ }
175+ if (imageData === undefined) {
176+ return undefined;
177+ }
178+ const imageSource: image.ImageSource = image.createImageSource(imageData);
179+ try {
180+ const imageInfo = await imageSource.getImageInfo();
181+ const imageWidth = Math.round(imageInfo.size.width);
182+ const imageHeight = Math.round(imageInfo.size.height);
183+ const option: image.InitializationOptions = {
184+ 'alphaType': 0,
185+ 'editable': false,
186+ 'pixelFormat': 3,
187+ 'scaleMode': 1,
188+ 'size': { height: imageHeight, width: imageWidth },
189+ }
190+ return await imageSource.createPixelMap(option);
123 } finally {191 } finally {
124- httpRequest.destroy();192+ imageSource.release();
125 }193 }
126 }194 }
127 195 
@@ -133,7 +201,7 @@ export class RNImageRotateTurboModule extends TurboModule implements TM.ImageRot
133 let imagePackApi: image.ImagePacker | undefined = undefined;201 let imagePackApi: image.ImagePacker | undefined = undefined;
134 let imageSourceFromBuffer: image.ImageSource | undefined = undefined;202 let imageSourceFromBuffer: image.ImageSource | undefined = undefined;
135 try {203 try {
136- file = fs.openSync(src, fs.OpenMode.READ_WRITE);204+ file = fs.openSync(src, fs.OpenMode.READ_ONLY);
137 imageSource = image.createImageSource(file.fd);205 imageSource = image.createImageSource(file.fd);
138 imagePackApi = image.createImagePacker();206 imagePackApi = image.createImagePacker();
139 const imageInfo = await imageSource.getImageInfo();207 const imageInfo = await imageSource.getImageInfo();
@@ -161,7 +229,8 @@ export class RNImageRotateTurboModule extends TurboModule implements TM.ImageRot
161 if (file === undefined) {229 if (file === undefined) {
162 throw new Error('Cannot open bitmap: ' + src);230 throw new Error('Cannot open bitmap: ' + src);
163 }231 }
164- console.error("getPixelMapFromFile failed with error message: " + err.message + ", error code: " + err.code);232+ console.error("getPixelMapFromFile failed with error message: " + (err as BusinessError).message + ", error code: " + (err as BusinessError).code);
233+ throw new Error('Cannot decode bitmap: ' + src);
165 } finally {234 } finally {
166 if (imageSourceFromBuffer !== undefined) {235 if (imageSourceFromBuffer !== undefined) {
167 imageSourceFromBuffer.release();236 imageSourceFromBuffer.release();
@@ -181,7 +250,7 @@ export class RNImageRotateTurboModule extends TurboModule implements TM.ImageRot
181 async openBitmapInputStream(muri:string): Promise<image.PixelMap> {250 async openBitmapInputStream(muri:string): Promise<image.PixelMap> {
182 try {251 try {
183 let imagePixelMap: image.PixelMap | undefined = undefined;252 let imagePixelMap: image.PixelMap | undefined = undefined;
184- if (muri.includes('http')) {253+ if (RNImageRotateTurboModule.isRemoteUri(muri)) {
185 imagePixelMap = await this.getPixelMapFromURL(muri);254 imagePixelMap = await this.getPixelMapFromURL(muri);
186 } else {255 } else {
187 imagePixelMap = await this.getPixelMapFromFile(muri);256 imagePixelMap = await this.getPixelMapFromFile(muri);
@@ -192,8 +261,8 @@ export class RNImageRotateTurboModule extends TurboModule implements TM.ImageRot
192 }261 }
193 return imagePixelMap;262 return imagePixelMap;
194 } catch (err) {263 } catch (err) {
195- console.error('openBitmapInputStream failed: ' + err.message);264+ console.error('openBitmapInputStream failed: ' + (err as BusinessError).message);
196- this.mError(err.message);265+ this.mError((err as BusinessError).message);
197 return undefined;266 return undefined;
198 }267 }
199 }268 }
@@ -211,8 +280,8 @@ export class RNImageRotateTurboModule extends TurboModule implements TM.ImageRot
211 await fs.write(tempFile.fd, buf);280 await fs.write(tempFile.fd, buf);
212 this.mSuccess(src);281 this.mSuccess(src);
213 } catch (err) {282 } catch (err) {
214- console.info("生成路径失败 "+ err.message);283+ console.info("生成路径失败 "+ (err as BusinessError).message);
215- this.mError(err.message);284+ this.mError((err as BusinessError).message);
216 } finally {285 } finally {
217 if (imagePackerApi !== undefined) {286 if (imagePackerApi !== undefined) {
218 imagePackerApi.release();287 imagePackerApi.release();
@@ -237,4 +306,4 @@ export class RNImageRotateTurboModule extends TurboModule implements TM.ImageRot
237 return ".jpg";306 return ".jpg";
238 }307 }
239 }308 }
240-}309+}
@@ -0,0 +1,27 @@
1+/**
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ *
4+ * This source code is licensed under the MIT license found in the
5+ * LICENSE file in the root directory of this source tree.
6+ */
7+'use strict';
8+ 
9+const { TurboModuleRegistry, __nativeModule } = require('react-native');
10+const NativeImageRotate = require('../../src/NativeImageRotate').default;
11+ 
12+describe('NativeImageRotate spec', () => {
13+ // TurboModuleRegistry.get runs while NativeImageRotate.ts is imported.
14+ const registryCalls = TurboModuleRegistry.get.mock.calls.slice();
15+ 
16+ it('resolves the ImageRotateNativeModule at import time', () => {
17+ expect(registryCalls).toEqual([['ImageRotateNativeModule']]);
18+ });
19+ 
20+ it('exports the resolved turbo module as the default export', () => {
21+ expect(NativeImageRotate).toBe(__nativeModule);
22+ });
23+ 
24+ it('exposes the rotateImage method required by the spec', () => {
25+ expect(typeof NativeImageRotate.rotateImage).toBe('function');
26+ });
27+});
@@ -0,0 +1,96 @@
1+/**
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ *
4+ * This source code is licensed under the MIT license found in the
5+ * LICENSE file in the root directory of this source tree.
6+ */
7+'use strict';
8+ 
9+const { TurboModuleRegistry, __nativeModule } = require('react-native');
10+const ImageRotate = require('../../index').default;
11+ 
12+describe('ImageRotate', () => {
13+ // TurboModuleRegistry.get runs while index.js is imported, before the tests.
14+ const registryCalls = TurboModuleRegistry.get.mock.calls.slice();
15+ 
16+ beforeEach(() => {
17+ __nativeModule.rotateImage.mockClear();
18+ });
19+ 
20+ it('resolves the native module once at import time', () => {
21+ expect(registryCalls).toEqual([['ImageRotateNativeModule']]);
22+ });
23+ 
24+ it('exposes rotateImage as a static method', () => {
25+ expect(typeof ImageRotate.rotateImage).toBe('function');
26+ });
27+ 
28+ it('forwards uri, angle and callbacks to the native module', () => {
29+ const success = jest.fn();
30+ const failure = jest.fn();
31+ 
32+ ImageRotate.rotateImage('file:///tmp/photo.jpg', 90, success, failure);
33+ 
34+ expect(__nativeModule.rotateImage).toHaveBeenCalledTimes(1);
35+ expect(__nativeModule.rotateImage).toHaveBeenCalledWith(
36+ 'file:///tmp/photo.jpg',
37+ 90,
38+ success,
39+ failure,
40+ );
41+ });
42+ 
43+ it('forwards negative angles for counter-clockwise rotation', () => {
44+ const success = jest.fn();
45+ const failure = jest.fn();
46+ 
47+ ImageRotate.rotateImage(
48+ 'https://example.com/photo.jpg',
49+ -180,
50+ success,
51+ failure,
52+ );
53+ 
54+ expect(__nativeModule.rotateImage).toHaveBeenCalledWith(
55+ 'https://example.com/photo.jpg',
56+ -180,
57+ success,
58+ failure,
59+ );
60+ });
61+ 
62+ it('forwards a zero angle without invoking either callback', () => {
63+ const success = jest.fn();
64+ const failure = jest.fn();
65+ 
66+ ImageRotate.rotateImage('file:///tmp/photo.jpg', 0, success, failure);
67+ 
68+ expect(__nativeModule.rotateImage).toHaveBeenCalledWith(
69+ 'file:///tmp/photo.jpg',
70+ 0,
71+ success,
72+ failure,
73+ );
74+ expect(success).not.toHaveBeenCalled();
75+ expect(failure).not.toHaveBeenCalled();
76+ });
77+ 
78+ it('forwards custom callbacks as-is so native code can report results', () => {
79+ const success = jest.fn((rotatedUri) => rotatedUri);
80+ const failure = jest.fn((error) => error);
81+ 
82+ ImageRotate.rotateImage('file:///tmp/photo.jpg', 270, success, failure);
83+ 
84+ const [, , forwardedSuccess, forwardedFailure] =
85+ __nativeModule.rotateImage.mock.calls[0];
86+ 
87+ expect(forwardedSuccess).toBe(success);
88+ expect(forwardedFailure).toBe(failure);
89+ 
90+ forwardedSuccess('file:///tmp/rotated.jpg');
91+ forwardedFailure({ code: 'E_FAILED' });
92+ 
93+ expect(success).toHaveBeenCalledWith('file:///tmp/rotated.jpg');
94+ expect(failure).toHaveBeenCalledWith({ code: 'E_FAILED' });
95+ });
96+});
@@ -0,0 +1,14 @@
1+/**
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ *
4+ * This source code is licensed under the MIT license found in the
5+ * LICENSE file in the root directory of this source tree.
6+ */
7+'use strict';
8+ 
9+module.exports = {
10+ presets: [
11+ ['@babel/preset-env', { targets: { node: 'current' }, modules: 'commonjs' }],
12+ '@babel/preset-flow',
13+ ],
14+};
@@ -0,0 +1,55 @@
1+/**
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ *
4+ * This source code is licensed under the MIT license found in the
5+ * LICENSE file in the root directory of this source tree.
6+ */
7+'use strict';
8+ 
9+const path = require('path');
10+ 
11+module.exports = {
12+ rootDir: path.resolve(__dirname, '..'),
13+ roots: ['<rootDir>/jest'],
14+ testEnvironment: 'node',
15+ transform: {
16+ '^.+\\.tsx?$': [
17+ 'ts-jest',
18+ {
19+ tsconfig: path.join(__dirname, 'tsconfig.json'),
20+ diagnostics: false,
21+ },
22+ ],
23+ '^.+\\.jsx?$': [
24+ 'babel-jest',
25+ {
26+ configFile: path.join(__dirname, 'babel.config.js'),
27+ },
28+ ],
29+ },
30+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
31+ moduleNameMapper: {
32+ '^react-native$': '<rootDir>/jest/mocks/react-native.js',
33+ },
34+ testMatch: [
35+ '<rootDir>/jest/__tests__/**/*.test.js',
36+ '<rootDir>/jest/__tests__/**/*.test.ts',
37+ ],
38+ testPathIgnorePatterns: ['/node_modules/'],
39+ setupFiles: ['<rootDir>/jest/setup.js'],
40+ globals: {
41+ __DEV__: true,
42+ },
43+ transformIgnorePatterns: ['node_modules/'],
44+ collectCoverageFrom: ['index.js', 'src/**/*.{ts,tsx}'],
45+ coverageDirectory: '<rootDir>/jest/coverage',
46+ coverageReporters: ['text', 'text-summary', 'lcov', 'html'],
47+ coverageThreshold: {
48+ global: {
49+ statements: 100,
50+ branches: 100,
51+ functions: 100,
52+ lines: 100,
53+ },
54+ },
55+};
@@ -0,0 +1,25 @@
1+/**
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ *
4+ * This source code is licensed under the MIT license found in the
5+ * LICENSE file in the root directory of this source tree.
6+ */
7+'use strict';
8+ 
9+// Stand-in for the native ImageRotate TurboModule. The library resolves this
10+// module at import time through TurboModuleRegistry.get.
11+const nativeModule = {
12+ rotateImage: jest.fn(),
13+};
14+ 
15+const TurboModuleRegistry = {
16+ get: jest.fn((name) =>
17+ name === 'ImageRotateNativeModule' ? nativeModule : null,
18+ ),
19+ getEnforcing: jest.fn(() => nativeModule),
20+};
21+ 
22+module.exports = {
23+ TurboModuleRegistry,
24+ __nativeModule: nativeModule,
25+};
@@ -0,0 +1,10 @@
1+/**
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ *
4+ * This source code is licensed under the MIT license found in the
5+ * LICENSE file in the root directory of this source tree.
6+ */
7+'use strict';
8+ 
9+// React Native sources reference the __DEV__ global at runtime.
10+global.__DEV__ = true;
@@ -0,0 +1,15 @@
1+{
2+ "compilerOptions": {
3+ "target": "ES2019",
4+ "module": "CommonJS",
5+ "moduleResolution": "node",
6+ "esModuleInterop": true,
7+ "allowSyntheticDefaultImports": true,
8+ "resolveJsonModule": true,
9+ "isolatedModules": true,
10+ "skipLibCheck": true,
11+ "strict": false,
12+ "types": ["jest", "node"]
13+ },
14+ "include": ["../index.js", "../src/**/*.ts", "__tests__/**/*.ts"]
15+}
@@ -1,10 +1,11 @@
1{1{
2 "name": "@react-native-ohos/react-native-image-rotate",2 "name": "@react-native-ohos/react-native-image-rotate",
3- "version": "2.2.1-beta.1",3+ "version": "2.2.1-beta.2",
4 "description": "Rotate images from your react-native JavaScript code",4 "description": "Rotate images from your react-native JavaScript code",
5 "main": "index.js",5 "main": "index.js",
6 "scripts": {6 "scripts": {
7- "test": "echo \"Error: no test specified\" && exit 1",7+ "test": "jest --config jest/jest.config.js",
8+ "test:coverage": "jest --config jest/jest.config.js --coverage",
8 "pack": "npm pack",9 "pack": "npm pack",
9 "codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name react-native-image-rotate --cpp-output-path ./harmony/imageRotate/src/main/cpp/generated --ets-output-path ./harmony/imageRotate/src/main/ets/generated --turbo-modules-spec-paths ./src/NativeImageRotate.ts"10 "codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name react-native-image-rotate --cpp-output-path ./harmony/imageRotate/src/main/cpp/generated --ets-output-path ./harmony/imageRotate/src/main/ets/generated --turbo-modules-spec-paths ./src/NativeImageRotate.ts"
10 },11 },
@@ -18,7 +19,7 @@
18 ],19 ],
19 "repository": {20 "repository": {
20 "type": "git",21 "type": "git",
21- "url": "https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate.git"22+ "url": "https://atomgit.com/CPF-RN/rntpc_react-native-image-rotate.git"
22 },23 },
23 "harmony": {24 "harmony": {
24 "alias": "react-native-image-rotate"25 "alias": "react-native-image-rotate"
@@ -35,12 +36,24 @@
35 ],36 ],
36 "license": "MIT",37 "license": "MIT",
37 "bugs": {38 "bugs": {
38- "url": "https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/issues"39+ "url": "https://atomgit.com/CPF-RN/rntpc_react-native-image-rotate/issues"
39 },40 },
40- "homepage": "https://gitcode.com/CPF-RN/rntpc_react-native-image-rotate/tree/br_rnoh0.77#readme",41+ "homepage": "https://atomgit.com/CPF-RN/rntpc_react-native-image-rotate/tree/br_rnoh0.77#readme",
41 "devDependencies": {42 "devDependencies": {
43+ "@babel/core": "^7.25.2",
44+ "@babel/preset-env": "^7.25.3",
45+ "@babel/preset-flow": "^7.24.7",
46+ "@types/jest": "^29.5.13",
47+ "babel-jest": "^29.7.0",
48+ "jest": "^29.7.0",
42 "react-native": "0.72.2",49 "react-native": "0.72.2",
50+ "ts-jest": "^29.2.5",
51+ "typescript": "^5.5.4",
43 "@rnoh/react-native-harmony-cli": "npm:@react-native-oh/react-native-harmony-cli@^0.0.27"52 "@rnoh/react-native-harmony-cli": "npm:@react-native-oh/react-native-harmony-cli@^0.0.27"
53+ },
54+ "publishConfig": {
55+ "access": "public",
56+ "registry": "https://registry.npmjs.org"
44 }57 }
45}58}
46 59