react-native-rectangle-doc-scanner 10.4.0 → 10.6.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.
@@ -80,6 +80,12 @@ class CameraController(
80
80
  return
81
81
  }
82
82
 
83
+ // Check lifecycle state
84
+ Log.d(TAG, "[CAMERAX] Current lifecycle state: ${lifecycleOwner.lifecycle.currentState}")
85
+ if (lifecycleOwner.lifecycle.currentState != androidx.lifecycle.Lifecycle.State.RESUMED) {
86
+ Log.w(TAG, "[CAMERAX] Lifecycle is not RESUMED, camera stream may not start")
87
+ }
88
+
83
89
  // Select camera
84
90
  val cameraSelector = if (useFrontCamera) {
85
91
  CameraSelector.DEFAULT_FRONT_CAMERA
@@ -97,7 +103,30 @@ class CameraController(
97
103
  .build()
98
104
  .also { previewUseCase ->
99
105
  Log.d(TAG, "[CAMERAX] Setting SurfaceProvider...")
100
- previewUseCase.setSurfaceProvider(previewView.surfaceProvider)
106
+
107
+ // Set surface provider with custom executor to see when surface is requested
108
+ previewUseCase.setSurfaceProvider(ContextCompat.getMainExecutor(context)) { request ->
109
+ Log.d(TAG, "[CAMERAX] ===== SURFACE REQUESTED =====")
110
+ Log.d(TAG, "[CAMERAX] Surface resolution: ${request.resolution}")
111
+ Log.d(TAG, "[CAMERAX] Surface camera: ${request.camera}")
112
+
113
+ // Get the surface from PreviewView and provide it to the request
114
+ val surfaceTexture = (previewView.getChildAt(0) as? android.view.TextureView)?.surfaceTexture
115
+ if (surfaceTexture != null) {
116
+ Log.d(TAG, "[CAMERAX] Got SurfaceTexture from PreviewView")
117
+ surfaceTexture.setDefaultBufferSize(request.resolution.width, request.resolution.height)
118
+ val surface = android.view.Surface(surfaceTexture)
119
+ request.provideSurface(surface, ContextCompat.getMainExecutor(context)) { result ->
120
+ Log.d(TAG, "[CAMERAX] Surface result: ${result.resultCode}")
121
+ surface.release()
122
+ }
123
+ } else {
124
+ Log.e(TAG, "[CAMERAX] Failed to get SurfaceTexture - using default provider")
125
+ // Fallback to default behavior
126
+ previewView.surfaceProvider.onSurfaceRequested(request)
127
+ }
128
+ }
129
+
101
130
  Log.d(TAG, "[CAMERAX] SurfaceProvider set successfully")
102
131
  }
103
132
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "10.4.0",
3
+ "version": "10.6.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",