react-native-rectangle-doc-scanner 3.39.0 → 3.40.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.
- package/dist/FullDocScanner.js +7 -7
- package/package.json +1 -1
- package/src/FullDocScanner.tsx +7 -7
- package/vendor/react-native-document-scanner/ios/DocumentScannerView.m +16 -2
- package/vendor/react-native-document-scanner/ios/RNPdfScannerManager.m +1 -1
- package/vendor/react-native-document-scanner/ios.js +2 -1
package/dist/FullDocScanner.js
CHANGED
|
@@ -69,13 +69,13 @@ const FullDocScanner = ({ onResult, onClose, detectionConfig, overlayColor = '#3
|
|
|
69
69
|
const processingCaptureRef = (0, react_1.useRef)(false);
|
|
70
70
|
const cropInitializedRef = (0, react_1.useRef)(false);
|
|
71
71
|
const mergedStrings = (0, react_1.useMemo)(() => ({
|
|
72
|
-
captureHint: strings?.captureHint
|
|
73
|
-
manualHint: strings?.manualHint
|
|
74
|
-
cancel: strings?.cancel
|
|
75
|
-
confirm: strings?.confirm
|
|
76
|
-
retake: strings?.retake
|
|
77
|
-
cropTitle: strings?.cropTitle
|
|
78
|
-
processing: strings?.processing
|
|
72
|
+
captureHint: strings?.captureHint,
|
|
73
|
+
manualHint: strings?.manualHint,
|
|
74
|
+
cancel: strings?.cancel,
|
|
75
|
+
confirm: strings?.confirm,
|
|
76
|
+
retake: strings?.retake,
|
|
77
|
+
cropTitle: strings?.cropTitle,
|
|
78
|
+
processing: strings?.processing,
|
|
79
79
|
}), [strings]);
|
|
80
80
|
(0, react_1.useEffect)(() => {
|
|
81
81
|
if (!capturedDoc) {
|
package/package.json
CHANGED
package/src/FullDocScanner.tsx
CHANGED
|
@@ -124,13 +124,13 @@ export const FullDocScanner: React.FC<FullDocScannerProps> = ({
|
|
|
124
124
|
|
|
125
125
|
const mergedStrings = useMemo(
|
|
126
126
|
() => ({
|
|
127
|
-
captureHint: strings?.captureHint
|
|
128
|
-
manualHint: strings?.manualHint
|
|
129
|
-
cancel: strings?.cancel
|
|
130
|
-
confirm: strings?.confirm
|
|
131
|
-
retake: strings?.retake
|
|
132
|
-
cropTitle: strings?.cropTitle
|
|
133
|
-
processing: strings?.processing
|
|
127
|
+
captureHint: strings?.captureHint,
|
|
128
|
+
manualHint: strings?.manualHint,
|
|
129
|
+
cancel: strings?.cancel,
|
|
130
|
+
confirm: strings?.confirm,
|
|
131
|
+
retake: strings?.retake,
|
|
132
|
+
cropTitle: strings?.cropTitle,
|
|
133
|
+
processing: strings?.processing,
|
|
134
134
|
}),
|
|
135
135
|
[strings],
|
|
136
136
|
);
|
|
@@ -56,15 +56,26 @@
|
|
|
56
56
|
switch (type) {
|
|
57
57
|
case IPDFRectangeTypeGood:
|
|
58
58
|
self.stableCounter ++;
|
|
59
|
+
NSLog(@"[DocumentScanner] Good rectangle detected, stableCounter: %ld/%ld", (long)self.stableCounter, (long)self.detectionCountBeforeCapture);
|
|
59
60
|
break;
|
|
60
|
-
|
|
61
|
+
case IPDFRectangeTypeNotFound:
|
|
62
|
+
NSLog(@"[DocumentScanner] Rectangle not found, resetting counter");
|
|
61
63
|
self.stableCounter = 0;
|
|
62
64
|
break;
|
|
65
|
+
default:
|
|
66
|
+
// For other types (bad rectangle), reduce counter slowly instead of resetting
|
|
67
|
+
if (self.stableCounter > 0) {
|
|
68
|
+
self.stableCounter--;
|
|
69
|
+
}
|
|
70
|
+
NSLog(@"[DocumentScanner] Bad rectangle detected (type: %ld), stableCounter: %ld", (long)type, (long)self.stableCounter);
|
|
71
|
+
break;
|
|
63
72
|
}
|
|
64
73
|
|
|
65
74
|
_lastDetectionType = type;
|
|
66
75
|
|
|
67
|
-
if (self.stableCounter
|
|
76
|
+
if (self.stableCounter >= self.detectionCountBeforeCapture){
|
|
77
|
+
NSLog(@"[DocumentScanner] Auto-capture triggered! stableCounter: %ld >= threshold: %ld", (long)self.stableCounter, (long)self.detectionCountBeforeCapture);
|
|
78
|
+
self.stableCounter = 0; // Reset to prevent multiple captures
|
|
68
79
|
[self capture];
|
|
69
80
|
}
|
|
70
81
|
}
|
|
@@ -101,8 +112,11 @@
|
|
|
101
112
|
}
|
|
102
113
|
|
|
103
114
|
- (void) capture {
|
|
115
|
+
NSLog(@"[DocumentScanner] capture called");
|
|
104
116
|
[self captureImageWithCompletionHander:^(UIImage *croppedImage, UIImage *initialImage, CIRectangleFeature *rectangleFeature) {
|
|
117
|
+
NSLog(@"[DocumentScanner] captureImageWithCompletionHander callback - croppedImage: %@, initialImage: %@", croppedImage ? @"YES" : @"NO", initialImage ? @"YES" : @"NO");
|
|
105
118
|
if (self.onPictureTaken) {
|
|
119
|
+
NSLog(@"[DocumentScanner] Calling onPictureTaken");
|
|
106
120
|
// Use maximum JPEG quality (1.0) or user's quality setting, whichever is higher
|
|
107
121
|
// This ensures no quality loss during compression
|
|
108
122
|
CGFloat imageQuality = MAX(self.quality, 0.95);
|
|
@@ -33,7 +33,7 @@ RCT_EXPORT_VIEW_PROPERTY(brightness, float)
|
|
|
33
33
|
RCT_EXPORT_VIEW_PROPERTY(contrast, float)
|
|
34
34
|
|
|
35
35
|
RCT_EXPORT_METHOD(capture) {
|
|
36
|
-
|
|
36
|
+
NSLog(@"[RNPdfScannerManager] capture called, scannerView: %@", _scannerView ? @"YES" : @"NO");
|
|
37
37
|
[_scannerView capture];
|
|
38
38
|
}
|
|
39
39
|
|