react-native-rectangle-doc-scanner 3.223.0 → 3.224.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.
@@ -175,11 +175,15 @@ class CameraController(
175
175
 
176
176
  val rotation = previewView.display?.rotation ?: Surface.ROTATION_0
177
177
 
178
- // Build Preview ONLY - this device cannot handle 2 simultaneous surfaces
178
+ // Build Preview ONLY - this device cannot handle 2 simultaneous surfaces initially
179
179
  preview = Preview.Builder()
180
180
  .setTargetResolution(Size(1280, 720))
181
181
  .setTargetRotation(rotation)
182
182
  .build()
183
+ .also {
184
+ // IMPORTANT: Set surface provider BEFORE binding
185
+ it.setSurfaceProvider(previewView.surfaceProvider)
186
+ }
183
187
 
184
188
  val cameraSelector = if (useFrontCamera) {
185
189
  CameraSelector.DEFAULT_FRONT_CAMERA
@@ -195,70 +199,18 @@ class CameraController(
195
199
  preview
196
200
  )
197
201
 
198
- // Set surface provider AFTER binding
199
- preview?.setSurfaceProvider(previewView.surfaceProvider)
200
-
201
- Log.d(TAG, "[CAMERAX-V7] Preview ONLY bound successfully")
202
+ Log.d(TAG, "[CAMERAX-V8] Preview ONLY bound successfully - camera preview should be visible")
202
203
 
203
- // Wait for preview to stabilize, then try adding ImageCapture
204
- android.os.Handler(android.os.Looper.getMainLooper()).postDelayed({
205
- tryAddImageCapture(provider, cameraSelector, rotation)
206
- }, 3000)
204
+ // DO NOT try to add ImageCapture - this device cannot handle it
205
+ // Keep Preview only mode
206
+ Log.d(TAG, "[CAMERAX-V8] Running in Preview-only mode (no auto-detection)")
207
207
 
208
208
  } catch (e: Exception) {
209
- Log.e(TAG, "[CAMERAX-V7] Failed to bind preview", e)
209
+ Log.e(TAG, "[CAMERAX-V8] Failed to bind preview", e)
210
210
  }
211
211
  }
212
212
 
213
- private fun tryAddImageCapture(provider: ProcessCameraProvider, cameraSelector: CameraSelector, rotation: Int) {
214
- Log.d(TAG, "[CAMERAX-V7] Attempting to add ImageCapture...")
215
-
216
- // Build ImageCapture with minimal resolution
217
- imageCapture = ImageCapture.Builder()
218
- .setTargetResolution(Size(320, 240))
219
- .setTargetRotation(rotation)
220
- .setCaptureMode(ImageCapture.CAPTURE_MODE_MINIMIZE_LATENCY)
221
- .build()
222
-
223
- try {
224
- // Unbind and rebind with both
225
- provider.unbindAll()
226
-
227
- camera = provider.bindToLifecycle(
228
- lifecycleOwner,
229
- cameraSelector,
230
- preview,
231
- imageCapture
232
- )
233
-
234
- preview?.setSurfaceProvider(previewView.surfaceProvider)
235
-
236
- Log.d(TAG, "[CAMERAX-V7] ImageCapture added successfully")
237
-
238
- // Start periodic frame capture
239
- if (detectionEnabled) {
240
- isAnalysisActive = true
241
- analysisHandler.postDelayed(analysisRunnable, 500)
242
- Log.d(TAG, "[CAMERAX-V7] Started periodic frame capture")
243
- }
244
-
245
- } catch (e: Exception) {
246
- Log.e(TAG, "[CAMERAX-V7] Failed to add ImageCapture, keeping Preview only", e)
247
-
248
- // Fallback: Keep preview only and disable detection
249
- try {
250
- camera = provider.bindToLifecycle(
251
- lifecycleOwner,
252
- cameraSelector,
253
- preview
254
- )
255
- preview?.setSurfaceProvider(previewView.surfaceProvider)
256
- Log.d(TAG, "[CAMERAX-V7] Fallback: Preview only mode (detection disabled)")
257
- } catch (fallbackException: Exception) {
258
- Log.e(TAG, "[CAMERAX-V7] Fallback failed", fallbackException)
259
- }
260
- }
261
- }
213
+ // Function removed - this device cannot handle ImageCapture + Preview simultaneously
262
214
 
263
215
  private fun captureFrameForAnalysis() {
264
216
  val capture = imageCapture ?: return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "3.223.0",
3
+ "version": "3.224.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",