react-native-rectangle-doc-scanner 3.170.0 → 3.172.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,15 +141,10 @@ 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
144
  Log.d(TAG, "[BIND] PreviewView: $previewView")
147
145
  Log.d(TAG, "[BIND] PreviewView.surfaceProvider: ${previewView.surfaceProvider}")
148
146
  Log.d(TAG, "[BIND] PreviewView attached to window: ${previewView.isAttachedToWindow}")
149
147
  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
-
153
148
  // Unbind all use cases before rebinding
154
149
  Log.d(TAG, "[BIND] Unbinding all existing use cases...")
155
150
  cameraProvider.unbindAll()
@@ -169,6 +164,14 @@ class CameraController(
169
164
  )
170
165
  Log.d(TAG, "[BIND] Bound to lifecycle successfully, camera: $camera")
171
166
 
167
+ Log.d(TAG, "[BIND] Setting surface provider to previewView...")
168
+ Log.d(TAG, "[BIND] PreviewView: $previewView")
169
+ Log.d(TAG, "[BIND] PreviewView.surfaceProvider: ${previewView.surfaceProvider}")
170
+ // Devices with the SurfaceOrderQuirk expect the preview surface to be set last.
171
+ // Apply the SurfaceProvider after binding so the preview stays on top.
172
+ preview.setSurfaceProvider(previewView.surfaceProvider)
173
+ Log.d(TAG, "[BIND] Surface provider set successfully")
174
+
172
175
  // Restore torch state if it was enabled
173
176
  if (torchEnabled) {
174
177
  Log.d(TAG, "[BIND] Restoring torch state...")
@@ -77,13 +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 PERFORMANCE mode (SurfaceView) for better performance
80
+ // SurfaceView backed preview avoids black frames on some MediaTek devices
81
81
  implementationMode = PreviewView.ImplementationMode.PERFORMANCE
82
- // Force visibility to ensure the view is rendered
83
82
  visibility = View.VISIBLE
84
- // Keep the screen on while preview is active
85
83
  keepScreenOn = true
86
- // Request layout to ensure proper sizing
84
+ // Ensure the preview stays behind overlays even if SurfaceFlinger reorders surfaces
85
+ setZOrderOnTop(false)
87
86
  requestLayout()
88
87
  }
89
88
  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.170.0",
3
+ "version": "3.172.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",