react-native-rectangle-doc-scanner 3.226.0 → 3.227.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.
@@ -43,6 +43,7 @@ class CameraController(
43
43
  private val cameraExecutor: ExecutorService = Executors.newSingleThreadExecutor()
44
44
  private val lastFrame = AtomicReference<LastFrame?>()
45
45
  private var analysisBound = false
46
+ private var pendingBindAttempts = 0
46
47
 
47
48
  private var useFrontCamera = false
48
49
  private var detectionEnabled = true
@@ -167,6 +168,18 @@ class CameraController(
167
168
  }
168
169
 
169
170
  private fun bindCameraUseCases() {
171
+ if (!previewView.isAttachedToWindow || previewView.width == 0 || previewView.height == 0) {
172
+ if (pendingBindAttempts < 5) {
173
+ pendingBindAttempts++
174
+ Log.d(TAG, "[CAMERAX-V9] PreviewView not ready (attached=${previewView.isAttachedToWindow}, w=${previewView.width}, h=${previewView.height}), retrying...")
175
+ previewView.post { bindCameraUseCases() }
176
+ } else {
177
+ Log.w(TAG, "[CAMERAX-V9] PreviewView still not ready after retries, aborting bind")
178
+ }
179
+ return
180
+ }
181
+ pendingBindAttempts = 0
182
+
170
183
  val provider = cameraProvider ?: return
171
184
  provider.unbindAll()
172
185
  analysisBound = false
@@ -78,7 +78,8 @@ class DocumentScannerView(context: ThemedReactContext) : FrameLayout(context), L
78
78
  layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
79
79
  visibility = View.VISIBLE
80
80
  keepScreenOn = true
81
- implementationMode = PreviewView.ImplementationMode.COMPATIBLE
81
+ // SurfaceView path is more stable on some devices during session config.
82
+ implementationMode = PreviewView.ImplementationMode.PERFORMANCE
82
83
  scaleType = PreviewView.ScaleType.FILL_CENTER
83
84
  }
84
85
  Log.d(TAG, "[INIT] PreviewView created: $previewView")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "3.226.0",
3
+ "version": "3.227.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",