react-native-rectangle-doc-scanner 3.70.0 → 3.72.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.
@@ -244,6 +244,8 @@ const FullDocScanner = ({ onResult, onClose, detectionConfig, overlayColor = '#3
244
244
  }
245
245
  const imageUri = result.assets[0].uri;
246
246
  console.log('[FullDocScanner] Gallery image selected:', imageUri);
247
+ // Allow the picker dismissal animation to complete before presenting the cropper
248
+ await new Promise((resolve) => setTimeout(resolve, 200));
247
249
  // Open cropper with the selected image
248
250
  await openCropper(imageUri);
249
251
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "3.70.0",
3
+ "version": "3.72.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -326,6 +326,9 @@ export const FullDocScanner: React.FC<FullDocScannerProps> = ({
326
326
  const imageUri = result.assets[0].uri;
327
327
  console.log('[FullDocScanner] Gallery image selected:', imageUri);
328
328
 
329
+ // Allow the picker dismissal animation to complete before presenting the cropper
330
+ await new Promise((resolve) => setTimeout(resolve, 200));
331
+
329
332
  // Open cropper with the selected image
330
333
  await openCropper(imageUri);
331
334
  } catch (error) {
@@ -34,20 +34,16 @@ RCT_EXPORT_VIEW_PROPERTY(quality, float)
34
34
  RCT_EXPORT_VIEW_PROPERTY(brightness, float)
35
35
  RCT_EXPORT_VIEW_PROPERTY(contrast, float)
36
36
 
37
- // Main capture method - returns a Promise
37
+ // Main capture method - accept reactTag when available (falls back to cached view)
38
38
  RCT_EXPORT_METHOD(capture:(nullable id)reactTag
39
39
  resolver:(RCTPromiseResolveBlock)resolve
40
40
  rejecter:(RCTPromiseRejectBlock)reject) {
41
41
  NSLog(@"[RNPdfScannerManager] capture called with reactTag: %@", reactTag);
42
42
  dispatch_async(dispatch_get_main_queue(), ^{
43
43
  DocumentScannerView *targetView = nil;
44
- NSNumber *resolvedTag = ([reactTag isKindOfClass:[NSNumber class]]) ? (NSNumber *)reactTag : nil;
45
44
 
46
- if (!resolvedTag && reactTag) {
47
- NSLog(@"[RNPdfScannerManager] Unexpected reactTag type %@ - ignoring reactTag", NSStringFromClass([reactTag class]));
48
- }
49
-
50
- if (resolvedTag) {
45
+ if ([reactTag isKindOfClass:[NSNumber class]]) {
46
+ NSNumber *resolvedTag = (NSNumber *)reactTag;
51
47
  UIView *view = [self.bridge.uiManager viewForReactTag:resolvedTag];
52
48
  if ([view isKindOfClass:[DocumentScannerView class]]) {
53
49
  targetView = (DocumentScannerView *)view;
@@ -57,6 +53,8 @@ RCT_EXPORT_METHOD(capture:(nullable id)reactTag
57
53
  } else {
58
54
  NSLog(@"[RNPdfScannerManager] No view found for tag %@", resolvedTag);
59
55
  }
56
+ } else if (reactTag) {
57
+ NSLog(@"[RNPdfScannerManager] Unexpected reactTag type %@ - ignoring reactTag", NSStringFromClass([reactTag class]));
60
58
  }
61
59
 
62
60
  if (!targetView && self->_scannerView) {
@@ -65,7 +63,7 @@ RCT_EXPORT_METHOD(capture:(nullable id)reactTag
65
63
  }
66
64
 
67
65
  if (!targetView) {
68
- NSLog(@"[RNPdfScannerManager] ERROR: No scanner view available for capture");
66
+ NSLog(@"[RNPdfScannerManager] ERROR: Scanner view not yet ready for capture");
69
67
  if (reject) {
70
68
  reject(@"NO_VIEW", @"Document scanner view is not ready", nil);
71
69
  }
@@ -37,7 +37,6 @@ class PdfScanner extends React.Component {
37
37
  return Promise.reject(error);
38
38
  }
39
39
 
40
- console.log('[PdfScanner/ios.js] Calling native capture with handle:', handle);
41
40
  return NativeModules.RNPdfScannerManager.capture(handle);
42
41
  }
43
42