react-native-rectangle-doc-scanner 3.85.0 → 3.86.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
CHANGED
|
@@ -171,6 +171,9 @@ const FullDocScanner = ({ onResult, onClose, detectionConfig, overlayColor = '#3
|
|
|
171
171
|
catch (error) {
|
|
172
172
|
console.error('[FullDocScanner] openCropper error:', error);
|
|
173
173
|
setProcessing(false);
|
|
174
|
+
// Reset capture state when cropper fails or is cancelled
|
|
175
|
+
captureInProgressRef.current = false;
|
|
176
|
+
captureModeRef.current = null;
|
|
174
177
|
const errorCode = error?.code;
|
|
175
178
|
const errorMessage = error?.message || String(error);
|
|
176
179
|
if (errorCode === CROPPER_TIMEOUT_CODE || errorMessage === CROPPER_TIMEOUT_CODE) {
|
package/package.json
CHANGED
package/src/FullDocScanner.tsx
CHANGED
|
@@ -231,6 +231,10 @@ export const FullDocScanner: React.FC<FullDocScannerProps> = ({
|
|
|
231
231
|
console.error('[FullDocScanner] openCropper error:', error);
|
|
232
232
|
setProcessing(false);
|
|
233
233
|
|
|
234
|
+
// Reset capture state when cropper fails or is cancelled
|
|
235
|
+
captureInProgressRef.current = false;
|
|
236
|
+
captureModeRef.current = null;
|
|
237
|
+
|
|
234
238
|
const errorCode = (error as any)?.code;
|
|
235
239
|
const errorMessage = (error as any)?.message || String(error);
|
|
236
240
|
|
|
@@ -28,13 +28,28 @@
|
|
|
28
28
|
[self setupCameraView];
|
|
29
29
|
[self start];
|
|
30
30
|
_hasSetupCamera = YES;
|
|
31
|
+
} else if (_hasSetupCamera && self.window && !CGRectIsEmpty(self.bounds)) {
|
|
32
|
+
// Check if camera session is running, restart if needed
|
|
33
|
+
if (self.captureSession && !self.captureSession.isRunning) {
|
|
34
|
+
NSLog(@"[DocumentScanner] Camera session not running, restarting...");
|
|
35
|
+
[self start];
|
|
36
|
+
}
|
|
31
37
|
}
|
|
32
38
|
}
|
|
33
39
|
|
|
34
40
|
- (void)didMoveToWindow {
|
|
35
41
|
[super didMoveToWindow];
|
|
36
|
-
if (
|
|
42
|
+
if (self.window && _hasSetupCamera) {
|
|
43
|
+
// Restart camera when view is added back to window
|
|
44
|
+
if (self.captureSession && !self.captureSession.isRunning) {
|
|
45
|
+
NSLog(@"[DocumentScanner] View added to window, restarting camera...");
|
|
46
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
47
|
+
[self start];
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
} else if (!self.window && _hasSetupCamera) {
|
|
37
51
|
// Stop camera when view is removed from window
|
|
52
|
+
NSLog(@"[DocumentScanner] View removed from window, stopping camera");
|
|
38
53
|
[self stop];
|
|
39
54
|
}
|
|
40
55
|
}
|