react-native-rectangle-doc-scanner 3.95.0 → 3.96.0

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.
@@ -330,18 +330,17 @@ const FullDocScanner = ({ onResult, onClose, detectionConfig, overlayColor = '#3
330
330
  const handleFlashToggle = (0, react_1.useCallback)(() => {
331
331
  setFlashEnabled(prev => !prev);
332
332
  }, []);
333
- const handleRotateImage = (0, react_1.useCallback)(async (degrees) => {
333
+ const handleRotateImage = (0, react_1.useCallback)((degrees) => {
334
334
  if (!croppedImageData)
335
335
  return;
336
- try {
337
- // UI 회전 상태 먼저 업데이트 (즉각 반응)
338
- setRotationDegrees(prev => {
339
- const newRotation = (prev + degrees + 360) % 360;
340
- return newRotation;
341
- });
342
- console.log('[FullDocScanner] Starting image rotation...');
343
- // ImageRotate를 사용해서 실제로 이미지 회전 (UI 없이)
344
- const rotatedImagePath = await react_native_image_rotate_1.default.rotateImage(croppedImageData.path, degrees);
336
+ // UI 회전 상태 먼저 업데이트 (즉각 반응)
337
+ setRotationDegrees(prev => {
338
+ const newRotation = (prev + degrees + 360) % 360;
339
+ return newRotation;
340
+ });
341
+ console.log('[FullDocScanner] Starting image rotation...');
342
+ // ImageRotate를 사용해서 실제로 이미지 회전 (callback 기반)
343
+ react_native_image_rotate_1.default.rotateImage(croppedImageData.path, degrees, (rotatedImagePath) => {
345
344
  console.log('[FullDocScanner] Image rotated successfully:', rotatedImagePath);
346
345
  // 회전된 이미지로 교체
347
346
  setCroppedImageData({
@@ -350,15 +349,14 @@ const FullDocScanner = ({ onResult, onClose, detectionConfig, overlayColor = '#3
350
349
  });
351
350
  // rotation degrees는 0으로 리셋 (이미 실제 파일에 적용되었으므로)
352
351
  setRotationDegrees(0);
353
- }
354
- catch (error) {
352
+ }, (error) => {
355
353
  console.error('[FullDocScanner] Image rotation error:', error);
356
354
  // 에러 발생 시 UI rotation 원복
357
355
  setRotationDegrees(prev => {
358
356
  const revertRotation = (prev - degrees + 360) % 360;
359
357
  return revertRotation;
360
358
  });
361
- }
359
+ });
362
360
  }, [croppedImageData]);
363
361
  const handleConfirm = (0, react_1.useCallback)(() => {
364
362
  if (!croppedImageData)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "3.95.0",
3
+ "version": "3.96.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -441,42 +441,42 @@ export const FullDocScanner: React.FC<FullDocScannerProps> = ({
441
441
  setFlashEnabled(prev => !prev);
442
442
  }, []);
443
443
 
444
- const handleRotateImage = useCallback(async (degrees: -90 | 90) => {
444
+ const handleRotateImage = useCallback((degrees: -90 | 90) => {
445
445
  if (!croppedImageData) return;
446
446
 
447
- try {
448
- // UI 회전 상태 먼저 업데이트 (즉각 반응)
449
- setRotationDegrees(prev => {
450
- const newRotation = (prev + degrees + 360) % 360;
451
- return newRotation;
452
- });
447
+ // UI 회전 상태 먼저 업데이트 (즉각 반응)
448
+ setRotationDegrees(prev => {
449
+ const newRotation = (prev + degrees + 360) % 360;
450
+ return newRotation;
451
+ });
453
452
 
454
- console.log('[FullDocScanner] Starting image rotation...');
453
+ console.log('[FullDocScanner] Starting image rotation...');
455
454
 
456
- // ImageRotate를 사용해서 실제로 이미지 회전 (UI 없이)
457
- const rotatedImagePath = await ImageRotate.rotateImage(
458
- croppedImageData.path,
459
- degrees,
460
- );
455
+ // ImageRotate를 사용해서 실제로 이미지 회전 (callback 기반)
456
+ ImageRotate.rotateImage(
457
+ croppedImageData.path,
458
+ degrees,
459
+ (rotatedImagePath: string) => {
460
+ console.log('[FullDocScanner] Image rotated successfully:', rotatedImagePath);
461
461
 
462
- console.log('[FullDocScanner] Image rotated successfully:', rotatedImagePath);
463
-
464
- // 회전된 이미지로 교체
465
- setCroppedImageData({
466
- path: rotatedImagePath,
467
- base64: undefined, // base64는 다시 읽어야 함
468
- });
462
+ // 회전된 이미지로 교체
463
+ setCroppedImageData({
464
+ path: rotatedImagePath,
465
+ base64: undefined, // base64는 다시 읽어야 함
466
+ });
469
467
 
470
- // rotation degrees는 0으로 리셋 (이미 실제 파일에 적용되었으므로)
471
- setRotationDegrees(0);
472
- } catch (error) {
473
- console.error('[FullDocScanner] Image rotation error:', error);
474
- // 에러 발생 UI rotation 원복
475
- setRotationDegrees(prev => {
476
- const revertRotation = (prev - degrees + 360) % 360;
477
- return revertRotation;
478
- });
479
- }
468
+ // rotation degrees는 0으로 리셋 (이미 실제 파일에 적용되었으므로)
469
+ setRotationDegrees(0);
470
+ },
471
+ (error: Error) => {
472
+ console.error('[FullDocScanner] Image rotation error:', error);
473
+ // 에러 발생 시 UI rotation 원복
474
+ setRotationDegrees(prev => {
475
+ const revertRotation = (prev - degrees + 360) % 360;
476
+ return revertRotation;
477
+ });
478
+ }
479
+ );
480
480
  }, [croppedImageData]);
481
481
 
482
482
  const handleConfirm = useCallback(() => {
@@ -3,6 +3,8 @@ declare module 'react-native-image-rotate' {
3
3
  static rotateImage(
4
4
  imagePath: string,
5
5
  degrees: number,
6
- ): Promise<string>;
6
+ successCallback: (rotatedImagePath: string) => void,
7
+ errorCallback: (error: Error) => void,
8
+ ): void;
7
9
  }
8
10
  }