react-native-rectangle-doc-scanner 3.169.0 → 3.170.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.
@@ -141,6 +141,15 @@ class CameraController(
141
141
  }
142
142
 
143
143
  try {
144
+ // Set surface provider BEFORE binding to lifecycle
145
+ Log.d(TAG, "[BIND] Setting surface provider to previewView...")
146
+ Log.d(TAG, "[BIND] PreviewView: $previewView")
147
+ Log.d(TAG, "[BIND] PreviewView.surfaceProvider: ${previewView.surfaceProvider}")
148
+ Log.d(TAG, "[BIND] PreviewView attached to window: ${previewView.isAttachedToWindow}")
149
+ Log.d(TAG, "[BIND] PreviewView size: ${previewView.width}x${previewView.height}")
150
+ preview.setSurfaceProvider(previewView.surfaceProvider)
151
+ Log.d(TAG, "[BIND] Surface provider set successfully")
152
+
144
153
  // Unbind all use cases before rebinding
145
154
  Log.d(TAG, "[BIND] Unbinding all existing use cases...")
146
155
  cameraProvider.unbindAll()
@@ -160,13 +169,6 @@ class CameraController(
160
169
  )
161
170
  Log.d(TAG, "[BIND] Bound to lifecycle successfully, camera: $camera")
162
171
 
163
- // Set surface provider AFTER binding to lifecycle
164
- Log.d(TAG, "[BIND] Setting surface provider to previewView...")
165
- Log.d(TAG, "[BIND] PreviewView: $previewView")
166
- Log.d(TAG, "[BIND] PreviewView.surfaceProvider: ${previewView.surfaceProvider}")
167
- preview.setSurfaceProvider(previewView.surfaceProvider)
168
- Log.d(TAG, "[BIND] Surface provider set successfully")
169
-
170
172
  // Restore torch state if it was enabled
171
173
  if (torchEnabled) {
172
174
  Log.d(TAG, "[BIND] Restoring torch state...")
@@ -77,11 +77,12 @@ 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 COMPATIBLE (TextureView) mode instead of PERFORMANCE (SurfaceView)
81
- // Some devices have issues with SurfaceView not creating the surface in time
82
- implementationMode = PreviewView.ImplementationMode.COMPATIBLE
80
+ // Use PERFORMANCE mode (SurfaceView) for better performance
81
+ implementationMode = PreviewView.ImplementationMode.PERFORMANCE
83
82
  // Force visibility to ensure the view is rendered
84
83
  visibility = View.VISIBLE
84
+ // Keep the screen on while preview is active
85
+ keepScreenOn = true
85
86
  // Request layout to ensure proper sizing
86
87
  requestLayout()
87
88
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "3.169.0",
3
+ "version": "3.170.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",