已合并
release: @react-native-ohos/react-native-image-crop-picker@0.40.8 #148
release: @react-native-ohos/react-native-image-crop-picker@0.40.8 #148
已合并
YongHengCode创建于 9月29日
共 4 个文件变更+28-33
@@ -5,41 +5,36 @@ All notable changes to this project will be documented in this file.
5The format is based on [Keep a Changelog](https://keepachangelog.com/zh-CN/1.0.0/),5The format is based on [Keep a Changelog](https://keepachangelog.com/zh-CN/1.0.0/),
6and this project adheres to [Semantic Versioning](https://semver.org/lang/zh-CN/).6and this project adheres to [Semantic Versioning](https://semver.org/lang/zh-CN/).
7 7 
8- 8+## [0.40.8] - 2026-09-29
9-## [0.40.8-rc.2]9+release: @react-native-ohos/react-native-image-crop-picker@0.40.8[148](https://gitcode.com/CPF-RN/rntpc_react-native-image-crop-picker/pull/148)
yangweiping
yangweipingyangweiping29 天前

0.40.8-rc.2 为私仓版本,合入0.40.8

likedislike
YongHengCode
YongHengCode
29 天前 评论:
10-- fix:所有 `Promise.reject('...')` 改为 `throw new Error(E_*_MSG)`;catch 块改为 `if (error instanceof Error) throw error;` 再包装非 Error 类型;引入 9 个错误消息常量与社区版保持一致
11-- 方法签名改为 `async Promise<Array<string>>`;`fs.copyFileSync` → `await fs.copyFile`;`fs.closeSync` 移入 `finally` 块
12-- add:新增私有方法 `checkCameraAvailability()`,基于 `camera.getCameraManager().getSupportedCameras()` 判断;openCamera 开头调用
13-- fix:openPicker:空路径 → `throw new Error(E_PICKER_CANCELLED_MSG)`;openCamera:添加 `pickerResult.resultCode === -1` 检测
14-- fix:在 `__onDestroy__` 中调用 `clearCropperAppStorage()` + `cleanTempFiles()`
15-- fix:进入前:`AppStorage.setOrCreate('cropImagePath', '')` + `setOrCreate('cropRect', null)`;回调后:同时清理 cropImagePath 和 cropRect
16-- fix:统一三元转换:`(raw === null/undefined/'') ? null : Number(raw)`
17-- fix:新增私有方法 `checkUIAbilityContext()`,三个入口方法开头调用
18-- fix:读取后立即 `AppStorage.setOrCreate('cropRect', null)`
19-- fix:修复`Constants.ts` 新增 15 个 `STORAGE_KEY_*` 常量 + `CROPPER_APPSTORAGE_KEYS` 数组;`clearCropperAppStorage()` 基于数组遍历清理
20-- 将 `closestAngle` 的计算逻辑移到 `setTimeout` 调用之前
21-- pm/cp 提升到 try 外声明(`undefined`);新增 catch 块释放 cp;finally 块补充释放 pm;成功路径用 `undefined` 标记已交出所有权
22-- **`CropModel` 新增 `initWidth`/`initHeight` 字段;`CropView.aboutToAppear` 中从 `@StorageProp` 同步到 model;`cropSync` 后若 `> 0` 调用 `cp.scaleSync(scaleX, scaleY)`
23-### 关联pr:
24-[141](https://gitcode.com/CPF-RN/rntpc_react-native-image-crop-picker/pull/141)
25- 
26- 
27- 
28- 
29-## [0.40.8-rc.1] - 2026-08-21
30 10 
31### Fixed11### Fixed
32 12 
33-- 图片压缩格式不再强制转换为 JPEG,按原格式或 `forceJpg` 配置选择编码。13+- 将 `Promise.reject(...)` 统一改为抛出错误,并在 `catch` 中保留已有 `Error`;补充与社区版一致的错误消息常量。
34-- `cleanSingle` 清理逻辑改为同步、可控的文件删除。14+- 修复选择器取消处理:`openPicker` 空路径抛出取消错误,`openCamera` 检查 `pickerResult.resultCode === -1`。
35-- 裁剪属性 `cropperRotateButtonHidden` 重命名为复数形式 `cropperRotateButtonsHidden`,与上游 API 保持一致。15+- 增加摄像头可用性检查和 UIAbilityContext 检查,避免在设备不可用或上下文缺失时继续调用原生接口。
16+- 在页面退出和裁剪流程前后清理 AppStorage 状态;读取 `cropRect` 后立即清空,并集中管理裁剪相关存储键。
17+- 将媒体时长安全转换为数字或 `null`。
18+- 修复 `closestAngle` 定时器中的计算顺序,以及裁剪异常路径中的资源释放。
19+- 修复裁剪尺寸同步:`CropModel` 增加 `initWidth`/`initHeight`,并在裁剪后按初始尺寸缩放。
20+- 图片压缩按原格式或 `forceJpg` 配置选择编码,不再强制转换为 JPEG。
21+- `cleanSingle` 改为同步、可控的文件删除,并正确返回 `clean` 和 `cleanSingle` 的 Promise。
36- 页面退出时清理更多裁剪配置状态,避免残留影响下一次裁剪。22- 页面退出时清理更多裁剪配置状态,避免残留影响下一次裁剪。
37-- 使原生接口、生成类型和 JS 声明保持同步。
38-- 正确返回 `clean` 和 `cleanSingle` 的 Promise。
39 23 
40-### 备注24+### Changed
41 25 
42-- pre-release: @react-native-ohos/react-native-image-crop-picker@0.40.8-rc.126+- `cropperRotateButtonHidden` 重命名为 `cropperRotateButtonsHidden`,与上游 API 保持一致。
27+- 文件复制改为异步 `fs.copyFile`;文件描述符在 `finally` 中关闭,相关方法改为 `async Promise<Array<string>>`。
28+- 保持原生接口、生成类型和 JS 声明同步。
29+ 
30+### Added
31+ 
32+- 新增 `checkCameraAvailability()`,基于 `camera.getCameraManager().getSupportedCameras()` 检查摄像头。
33+- 新增 15 个 `STORAGE_KEY_*` 常量及 `CROPPER_APPSTORAGE_KEYS`,供 `clearCropperAppStorage()` 集中清理。
34+ 
35+### 关联 PR
36+ 
37+[141](https://gitcode.com/CPF-RN/rntpc_react-native-image-crop-picker/pull/141)
43 38 
44## [0.40.7] - 2026-08-1839## [0.40.7] - 2026-08-18
45 40 
Mexample/package.json+2-2文件内容审核中,请稍后刷新重试
Mharmony/image_crop_picker/oh-package.json5+1-1文件内容审核中,请稍后刷新重试
Mpackage.json+1-1文件内容审核中,请稍后刷新重试