react-native-rectangle-doc-scanner 10.5.0 → 10.6.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.
@@ -103,7 +103,30 @@ class CameraController(
103
103
  .build()
104
104
  .also { previewUseCase ->
105
105
  Log.d(TAG, "[CAMERAX] Setting SurfaceProvider...")
106
- previewUseCase.setSurfaceProvider(previewView.surfaceProvider)
106
+
107
+ // Set surface provider with custom executor to see when surface is requested
108
+ previewUseCase.setSurfaceProvider(ContextCompat.getMainExecutor(context)) { request ->
109
+ Log.d(TAG, "[CAMERAX] ===== SURFACE REQUESTED =====")
110
+ Log.d(TAG, "[CAMERAX] Surface resolution: ${request.resolution}")
111
+ Log.d(TAG, "[CAMERAX] Surface camera: ${request.camera}")
112
+
113
+ // Get the surface from PreviewView and provide it to the request
114
+ val surfaceTexture = (previewView.getChildAt(0) as? android.view.TextureView)?.surfaceTexture
115
+ if (surfaceTexture != null) {
116
+ Log.d(TAG, "[CAMERAX] Got SurfaceTexture from PreviewView")
117
+ surfaceTexture.setDefaultBufferSize(request.resolution.width, request.resolution.height)
118
+ val surface = android.view.Surface(surfaceTexture)
119
+ request.provideSurface(surface, ContextCompat.getMainExecutor(context)) { result ->
120
+ Log.d(TAG, "[CAMERAX] Surface result: ${result.resultCode}")
121
+ surface.release()
122
+ }
123
+ } else {
124
+ Log.e(TAG, "[CAMERAX] Failed to get SurfaceTexture - using default provider")
125
+ // Fallback to default behavior
126
+ previewView.surfaceProvider.onSurfaceRequested(request)
127
+ }
128
+ }
129
+
107
130
  Log.d(TAG, "[CAMERAX] SurfaceProvider set successfully")
108
131
  }
109
132
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "10.5.0",
3
+ "version": "10.6.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",