react-native-rectangle-doc-scanner 3.216.0 → 3.217.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.
|
@@ -157,11 +157,14 @@ class CameraController(
|
|
|
157
157
|
|
|
158
158
|
val rotation = previewView.display?.rotation ?: Surface.ROTATION_0
|
|
159
159
|
|
|
160
|
-
// Build Preview
|
|
160
|
+
// Build Preview and set surface provider BEFORE binding
|
|
161
161
|
preview = Preview.Builder()
|
|
162
162
|
.setTargetAspectRatio(AspectRatio.RATIO_4_3)
|
|
163
163
|
.setTargetRotation(rotation)
|
|
164
164
|
.build()
|
|
165
|
+
.also {
|
|
166
|
+
it.setSurfaceProvider(previewView.surfaceProvider)
|
|
167
|
+
}
|
|
165
168
|
|
|
166
169
|
// Build ImageAnalysis
|
|
167
170
|
imageAnalysis = ImageAnalysis.Builder()
|
|
@@ -180,7 +183,7 @@ class CameraController(
|
|
|
180
183
|
CameraSelector.DEFAULT_BACK_CAMERA
|
|
181
184
|
}
|
|
182
185
|
|
|
183
|
-
// Bind both Preview and ImageAnalysis together in
|
|
186
|
+
// Bind both Preview and ImageAnalysis together in ONE call
|
|
184
187
|
try {
|
|
185
188
|
camera = provider.bindToLifecycle(
|
|
186
189
|
lifecycleOwner,
|
|
@@ -188,14 +191,10 @@ class CameraController(
|
|
|
188
191
|
preview,
|
|
189
192
|
imageAnalysis
|
|
190
193
|
)
|
|
191
|
-
|
|
192
|
-
// Set surface provider AFTER binding to avoid timeout
|
|
193
|
-
preview?.setSurfaceProvider(previewView.surfaceProvider)
|
|
194
|
-
|
|
195
194
|
analysisBound = true
|
|
196
|
-
Log.d(TAG, "[CAMERAX-FIX] Camera and analysis bound successfully
|
|
195
|
+
Log.d(TAG, "[CAMERAX-FIX-V2] Camera and analysis bound successfully")
|
|
197
196
|
} catch (e: Exception) {
|
|
198
|
-
Log.e(TAG, "[CAMERAX-FIX] Failed to bind camera use cases", e)
|
|
197
|
+
Log.e(TAG, "[CAMERAX-FIX-V2] Failed to bind camera use cases", e)
|
|
199
198
|
analysisBound = false
|
|
200
199
|
}
|
|
201
200
|
}
|
|
@@ -78,7 +78,7 @@ 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.
|
|
81
|
+
implementationMode = PreviewView.ImplementationMode.PERFORMANCE
|
|
82
82
|
scaleType = PreviewView.ScaleType.FILL_CENTER
|
|
83
83
|
}
|
|
84
84
|
Log.d(TAG, "[INIT] PreviewView created: $previewView")
|
package/package.json
CHANGED