react-native-rectangle-doc-scanner 3.162.0 → 3.164.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.
@@ -77,10 +77,11 @@ class DocumentScannerView(context: ThemedReactContext) : FrameLayout(context), L
77
77
  previewView = PreviewView(context).apply {
78
78
  layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
79
79
  scaleType = PreviewView.ScaleType.FILL_CENTER
80
- // Use TextureView instead of SurfaceView for better compatibility with React Native
81
- implementationMode = PreviewView.ImplementationMode.PERFORMANCE
80
+ // Force TextureView for React Native compatibility (SurfaceView has rendering issues)
81
+ implementationMode = PreviewView.ImplementationMode.TEXTURE_VIEW
82
82
  }
83
83
  Log.d(TAG, "[INIT] PreviewView created: $previewView")
84
+ Log.d(TAG, "[INIT] PreviewView implementationMode: ${previewView.implementationMode}")
84
85
 
85
86
  Log.d(TAG, "[INIT] Adding PreviewView to parent...")
86
87
  addView(previewView)
@@ -95,10 +96,6 @@ class DocumentScannerView(context: ThemedReactContext) : FrameLayout(context), L
95
96
  addView(overlayView)
96
97
  Log.d(TAG, "[INIT] OverlayView added, childCount: $childCount")
97
98
 
98
- Log.d(TAG, "[INIT] Setting lifecycle to CREATED...")
99
- lifecycleRegistry.currentState = Lifecycle.State.CREATED
100
- Log.d(TAG, "[INIT] Lifecycle state: ${lifecycleRegistry.currentState}")
101
-
102
99
  Log.d(TAG, "╔════════════════════════════════════════╗")
103
100
  Log.d(TAG, "║ DocumentScannerView INIT COMPLETE ║")
104
101
  Log.d(TAG, "╚════════════════════════════════════════╝")
@@ -116,6 +113,9 @@ class DocumentScannerView(context: ThemedReactContext) : FrameLayout(context), L
116
113
  // Setup and start camera when view is attached
117
114
  post {
118
115
  Log.d(TAG, "[POST] Starting camera setup...")
116
+ lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_CREATE)
117
+ lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_START)
118
+ lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_RESUME)
119
119
  setupCamera()
120
120
  startCamera()
121
121
  }
@@ -407,23 +407,11 @@ class DocumentScannerView(context: ThemedReactContext) : FrameLayout(context), L
407
407
  }
408
408
 
409
409
  // Transition lifecycle states properly
410
- val previousState = lifecycleRegistry.currentState
411
- when (lifecycleRegistry.currentState) {
412
- Lifecycle.State.CREATED -> {
413
- Log.d(TAG, "[START_CAMERA] Transitioning CREATED -> STARTED")
414
- lifecycleRegistry.currentState = Lifecycle.State.STARTED
415
- Log.d(TAG, "[START_CAMERA] Transitioning STARTED -> RESUMED")
416
- lifecycleRegistry.currentState = Lifecycle.State.RESUMED
417
- }
418
- Lifecycle.State.STARTED -> {
419
- Log.d(TAG, "[START_CAMERA] Transitioning STARTED -> RESUMED")
420
- lifecycleRegistry.currentState = Lifecycle.State.RESUMED
421
- }
422
- else -> {
423
- Log.d(TAG, "[START_CAMERA] Already in state: ${lifecycleRegistry.currentState}")
424
- }
410
+ Log.d(TAG, "[START_CAMERA] Ensuring lifecycle is RESUMED")
411
+ if (lifecycleRegistry.currentState != Lifecycle.State.DESTROYED) {
412
+ lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_START)
413
+ lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_RESUME)
425
414
  }
426
- Log.d(TAG, "[START_CAMERA] Lifecycle transitioned: $previousState -> ${lifecycleRegistry.currentState}")
427
415
 
428
416
  Log.d(TAG, "[START_CAMERA] Calling CameraController.startCamera()...")
429
417
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "3.162.0",
3
+ "version": "3.164.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",