@react-native-ohos/react-native-image-crop-picker 0.51.2-rc.1 → 0.51.2-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## 鸿蒙化Log
4
4
 
5
+ ### v0.51.2-rc.3
6
+
7
+ - fix: The issue of the PNG image being larger in memory than the one generated with a compression ratio of 0.8 to 1 has been resolved.
8
+ - pre-release: @react-native-ohos/react-native-image-crop-picker@0.51.2-rc.3
9
+
10
+ ### v0.51.2-rc.2
11
+
12
+ - fix: When canceling the photo selection, do not display an error prompt on the interface.
13
+ - pre-release: @react-native-ohos/react-native-image-crop-picker@0.51.2-rc.2
14
+
5
15
  ### v0.51.2-rc.1
6
16
 
7
17
  - feat: Updated the synchronization community to version 0.51.1, and modified and added attributes of third-party library components.
@@ -3,7 +3,7 @@
3
3
  "description": "Please describe the basic information.",
4
4
  "main": "index.ets",
5
5
  "type": "module",
6
- "version": "0.51.2-rc.1",
6
+ "version": "0.51.2-rc.3",
7
7
  "dependencies": {
8
8
  "@rnoh/react-native-openharmony": "file:../../node_modules/@react-native-oh/react-native-harmony/harmony/react_native_openharmony.har"
9
9
  },
@@ -292,12 +292,12 @@ export class ImageCropPickerTurboModule extends TurboModule implements ImageCrop
292
292
  let sourceFilePaths: Array<string> = result.photoUris as Array<string>;
293
293
  if (sourceFilePaths.length < MINIMUM_VALUE) {
294
294
  return new Promise(async (res, rej) => {
295
- rej('sourceFilePaths is empty')
295
+ Logger.info(`${TAG} sourceFilePaths is empty`);
296
296
  })
297
297
  }
298
298
  let tempFilePaths = null;
299
299
  Logger.info(`${TAG} into openPicker tempFilePaths ${JSON.stringify(sourceFilePaths)}`);
300
- if (qualityNumber !== 1 || forceJpg) {
300
+ if (!this.isNullOrUndefined(options.compressImageQuality) || forceJpg) {
301
301
  Logger.info(`${TAG} qualityNumber = ${qualityNumber} forceJpg = ${forceJpg}`);
302
302
  tempFilePaths = await this.compressPictures(qualityNumber * 100, forceJpg, sourceFilePaths);
303
303
  } else {
@@ -356,9 +356,8 @@ export class ImageCropPickerTurboModule extends TurboModule implements ImageCrop
356
356
 
357
357
  return this.getPickerResult(options, sourceFilePaths, tempFilePaths);
358
358
  } catch (error) {
359
- Logger.error(`${TAG} PhotoViewPicker failed err: ${JSON.stringify(error)}`);
360
359
  return new Promise(async (res, rej) => {
361
- rej('PhotoViewPicker is failed')
360
+ Logger.error(`${TAG} PhotoViewPicker failed err: ${JSON.stringify(error)}`);
362
361
  })
363
362
  }
364
363
  }
@@ -466,7 +465,7 @@ export class ImageCropPickerTurboModule extends TurboModule implements ImageCrop
466
465
  } else {
467
466
  Logger.info(`${TAG} into getPickerResult video start`);
468
467
  let qualityNumber = this.isNullOrUndefined(options.compressImageQuality) ? ImageQuality : options.compressImageQuality;
469
- if(qualityNumber !== 1){
468
+ if(!this.isNullOrUndefined(options.compressImageQuality)){
470
469
  results.path = this.isNullOrUndefined(tempFilePaths) ? null : value;
471
470
  } else {
472
471
  results.path = this.isNullOrUndefined(tempFilePaths) ? null : filePrefix + value;
@@ -562,7 +561,7 @@ export class ImageCropPickerTurboModule extends TurboModule implements ImageCrop
562
561
  }
563
562
  let tempFilePaths = null;
564
563
  let sourceFilePaths: Array<string> = [imgOrVideoPath];
565
- if (qualityNumber !== 1 || forceJpg) {
564
+ if (!this.isNullOrUndefined(options.compressImageQuality) || forceJpg) {
566
565
  Logger.info(`${TAG} into openCamera qualityNumber = ${qualityNumber} forceJpg = ${forceJpg}`);
567
566
  tempFilePaths = await this.compressPictures(qualityNumber * 100, forceJpg, sourceFilePaths);
568
567
  } else {
@@ -622,7 +621,7 @@ export class ImageCropPickerTurboModule extends TurboModule implements ImageCrop
622
621
  }
623
622
  } catch (error) {
624
623
  let err = error as BusinessError;
625
- rej(JSON.stringify(err));
624
+ Logger.error(JSON.stringify(err));
626
625
  }
627
626
  })
628
627
  };
@@ -692,8 +691,9 @@ export class ImageCropPickerTurboModule extends TurboModule implements ImageCrop
692
691
  let imageISs = image.createImageSource(files.fd);
693
692
  let imagePMs = await imageISs.createPixelMap();
694
693
  let imagePackerApi = await image.createImagePacker();
694
+ let jpgToJpeg = (imageType == 'jpg' ? 'jpeg':imageType);
695
695
  let options: image.PackingOption = {
696
- format: 'image/jpeg',
696
+ format: `image/${jpgToJpeg}`,
697
697
  quality: quality,
698
698
  };
699
699
  try {
@@ -805,7 +805,7 @@ export class ImageCropPickerTurboModule extends TurboModule implements ImageCrop
805
805
  Logger.info(`${TAG} into openCropper imgPath = ${imgPath}`);
806
806
  if (this.isNullOrUndefined(imgPath)) {
807
807
  return new Promise(async (res, rej) => {
808
- rej('imgPath is null')
808
+ Logger.info(`${TAG} imgPath is null`);
809
809
  })
810
810
  }
811
811
  let tempFilePaths = null;
@@ -1070,9 +1070,9 @@ export class ImageCropPickerTurboModule extends TurboModule implements ImageCrop
1070
1070
  .then((data: PermissionRequestResult) => {
1071
1071
  res(data?.authResults[0] === 0)
1072
1072
  }).catch((err) => {
1073
- res(false)
1074
- Logger.info(`${TAG} grantPermission err = ${JSON.stringify(err)}`);
1075
- })
1073
+ res(false)
1074
+ Logger.info(`${TAG} grantPermission err = ${JSON.stringify(err)}`);
1075
+ })
1076
1076
  });
1077
1077
  }
1078
1078
  }
@@ -5,7 +5,7 @@
5
5
  export namespace ImageCropPicker {
6
6
  export const NAME = 'ImageCropPicker' as const
7
7
 
8
- export type CropperOptions = {multiple?: boolean, minFiles?: number, maxFiles?: number, waitAnimationEnd?: boolean, smartAlbums?: unknown[], useFrontCamera?: boolean, loadingLabelText?: string, showsSelectedCount?: boolean, sortOrder?: string, hideBottomControls?: boolean, writeTempFile?: boolean, mediaType: string, width?: number, height?: number, includeBase64?: boolean, includeExif?: boolean, forceJpg?: boolean, cropping?: boolean, avoidEmptySpaceAroundImage?: boolean, cropperActiveWidgetColor?: string, cropperStatusBarLight?: boolean, cropperNavigationBarLight?: boolean, cropperToolbarColor?: string, cropperToolbarWidgetColor?: string, cropperToolbarTitle?: string, freeStyleCropEnabled?: boolean, cropperTintColor?: string, cropperCircleOverlay?: boolean, cropperCancelText?: string, cropperCancelColor?: string, cropperChooseText?: string, cropperChooseColor?: string, cropperRotateButtonHidden?: boolean, showCropGuidelines?: boolean, showCropFrame?: boolean, enableRotationGesture?: boolean, disableCropperColorSetters?: boolean, compressImageMaxWidth?: number, compressImageMaxHeight?: number, compressImageQuality?: number, path: string}
8
+ export type CropperOptions = {multiple?: boolean, minFiles?: number, maxFiles?: number, waitAnimationEnd?: boolean, smartAlbums?: unknown[], useFrontCamera?: boolean, loadingLabelText?: string, showsSelectedCount?: boolean, sortOrder?: string, hideBottomControls?: boolean, writeTempFile?: boolean, mediaType: string, width?: number, height?: number, includeBase64?: boolean, includeExif?: boolean, forceJpg?: boolean, cropping?: boolean, avoidEmptySpaceAroundImage?: boolean, cropperActiveWidgetColor?: string, cropperStatusBarColor?: string, cropperToolbarColor?: string, cropperToolbarWidgetColor?: string, cropperToolbarTitle?: string, freeStyleCropEnabled?: boolean, cropperTintColor?: string, cropperCircleOverlay?: boolean, cropperCancelText?: string, cropperCancelColor?: string, cropperChooseText?: string, cropperChooseColor?: string, cropperRotateButtonHidden?: boolean, showCropGuidelines?: boolean, showCropFrame?: boolean, enableRotationGesture?: boolean, disableCropperColorSetters?: boolean, compressImageMaxWidth?: number, compressImageMaxHeight?: number, compressImageQuality?: number, path: string}
9
9
 
10
10
  export type Exif = {}
11
11
 
Binary file
package/index.d.ts CHANGED
@@ -222,20 +222,12 @@ declare module "react-native-image-crop-picker" {
222
222
  cropperActiveWidgetColor?: string;
223
223
 
224
224
  /**
225
- * When cropping image, true for light status bar (dark icons), false for dark status bar (light icons).
225
+ * When cropping image, determines the color of StatusBar.
226
226
  *
227
227
  * @platform Android only
228
- * @default true
229
- */
230
- cropperStatusBarLight?: boolean;
231
-
232
- /**
233
- * When cropping image, true for light navigation bar (dark icons), false for dark navigation bar (light icons).
234
- *
235
- * @platform Android only
236
- * @default false
228
+ * @default '#424242'
237
229
  */
238
- cropperNavigationBarLight?: boolean;
230
+ cropperStatusBarColor?: string;
239
231
 
240
232
  /**
241
233
  * When cropping image, determines the color of Toolbar.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-ohos/react-native-image-crop-picker",
3
- "version": "0.51.2-rc.1",
3
+ "version": "0.51.2-rc.3",
4
4
  "description": "Select single or multiple images, with cropping option",
5
5
  "main": "js/index.js",
6
6
  "scripts": {
@@ -29,12 +29,12 @@
29
29
  "bugs": {
30
30
  "url": "https://gitcode.com/openharmony-sig/rntpc_react-native-image-crop-picker/issues"
31
31
  },
32
- "homepage": "https://gitcode.com/openharmony-sig/rntpc_react-native-image-crop-picker/tree/br_rnoh0.77#readme",
32
+ "homepage": "https://gitcode.com/openharmony-sig/rntpc_react-native-image-crop-picker/tree/br_rnoh0.82#readme",
33
33
  "dependencies": {
34
34
  "react-native-image-crop-picker": "^0.51.1"
35
35
  },
36
36
  "devDependencies": {
37
- "@react-native-oh/react-native-harmony-cli": "file:./packages/react-native-oh-react-native-harmony-cli-0.82.1.tgz"
37
+ "@react-native-oh/react-native-harmony-cli": "file:./packages/rnoh-react-native-harmony-cli-0.82.1.tgz"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "react": "*",