react-native-rectangle-doc-scanner 3.182.0 → 3.183.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.
@@ -315,6 +315,11 @@ class CameraController(
315
315
 
316
316
  override fun onError(exception: ImageCaptureException) {
317
317
  Log.e(TAG, "Photo capture failed", exception)
318
+ if (exception.imageCaptureError == ImageCapture.ERROR_CAMERA_CLOSED) {
319
+ Log.w(TAG, "Camera was closed during capture, attempting restart")
320
+ stopCamera()
321
+ startCamera(useFrontCamera, true)
322
+ }
318
323
  onError(exception)
319
324
  }
320
325
  }
@@ -269,6 +269,13 @@ class DocumentScannerView(context: ThemedReactContext) : FrameLayout(context), L
269
269
  return
270
270
  }
271
271
 
272
+ // Ensure lifecycle is active before attempting capture to avoid camera closed errors
273
+ if (lifecycleRegistry.currentState < Lifecycle.State.STARTED) {
274
+ Log.d(TAG, "Lifecycle not STARTED, current state: ${lifecycleRegistry.currentState}")
275
+ promise?.reject("LIFECYCLE_INACTIVE", "Camera preview not ready")
276
+ return
277
+ }
278
+
272
279
  isCapturing = true
273
280
  Log.d(TAG, "Capture initiated with promise: ${promise != null}")
274
281
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "3.182.0",
3
+ "version": "3.183.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",