react-native-rectangle-doc-scanner 3.177.0 → 3.179.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.
@@ -165,17 +165,18 @@ class CameraController(
165
165
  )
166
166
  Log.d(TAG, "[BIND] Bound to lifecycle successfully, camera: $camera")
167
167
 
168
- Log.d(TAG, "[BIND] Setting surface provider to previewView...")
168
+ // Set surface provider AFTER binding for all modes
169
+ // This ensures the camera is ready to receive the surface
170
+ Log.d(TAG, "[BIND] Binding completed, now setting surface provider...")
169
171
  Log.d(TAG, "[BIND] PreviewView: $previewView")
170
172
  Log.d(TAG, "[BIND] PreviewView.surfaceProvider: ${previewView.surfaceProvider}")
171
- // TextureView(Compatibility) 모드에서는 SurfaceProvider를 먼저 지정해도 순서 문제가 없다.
172
- // PERFORMANCE 모드(SurfaceView)에서는 SurfaceOrderQuirk 대응을 위해 바인딩 이후에 지정한다.
173
- if (previewView.implementationMode == PreviewView.ImplementationMode.COMPATIBLE) {
174
- preview.setSurfaceProvider(previewView.surfaceProvider)
175
- Log.d(TAG, "[BIND] Surface provider set immediately (COMPATIBLE mode)")
176
- } else {
173
+ Log.d(TAG, "[BIND] PreviewView.implementationMode: ${previewView.implementationMode}")
174
+
175
+ // Use postDelayed to ensure surface is ready (especially for SurfaceView)
176
+ previewView.post {
177
+ Log.d(TAG, "[BIND] Setting surface provider on UI thread...")
177
178
  preview.setSurfaceProvider(previewView.surfaceProvider)
178
- Log.d(TAG, "[BIND] Surface provider set after binding (PERFORMANCE mode)")
179
+ Log.d(TAG, "[BIND] Surface provider set successfully")
179
180
  }
180
181
 
181
182
  // Restore torch state if it was enabled
@@ -77,10 +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
- // TextureView (COMPATIBLE) avoids Surface ordering issues observed on some MediaTek devices
81
- implementationMode = PreviewView.ImplementationMode.COMPATIBLE
80
+ // Use PERFORMANCE (SurfaceView) for better reliability
81
+ implementationMode = PreviewView.ImplementationMode.PERFORMANCE
82
82
  visibility = View.VISIBLE
83
83
  keepScreenOn = true
84
+ // Force view to be drawn
85
+ setWillNotDraw(false)
84
86
  requestLayout()
85
87
  }
86
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.177.0",
3
+ "version": "3.179.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",