react-native-rectangle-doc-scanner 3.184.0 → 3.188.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.
@@ -108,7 +108,8 @@ class CameraController(
108
108
  // Preview use case
109
109
  Log.d(TAG, "[BIND] Creating Preview use case...")
110
110
  val preview = Preview.Builder()
111
- .setTargetResolution(Size(1080, 1920))
111
+ // Use aspect ratio to avoid unsupported size combinations on some devices.
112
+ .setTargetAspectRatio(AspectRatio.RATIO_4_3)
112
113
  .build()
113
114
  Log.d(TAG, "[BIND] Preview created: $preview")
114
115
 
@@ -116,7 +117,8 @@ class CameraController(
116
117
  Log.d(TAG, "[BIND] Creating ImageCapture use case...")
117
118
  imageCapture = ImageCapture.Builder()
118
119
  .setCaptureMode(ImageCapture.CAPTURE_MODE_MAXIMIZE_QUALITY)
119
- .setTargetResolution(Size(1920, 2560))
120
+ // Use aspect ratio to avoid unsupported size combinations on some devices.
121
+ .setTargetAspectRatio(AspectRatio.RATIO_4_3)
120
122
  .setFlashMode(ImageCapture.FLASH_MODE_AUTO)
121
123
  .build()
122
124
  Log.d(TAG, "[BIND] ImageCapture created: $imageCapture")
@@ -125,7 +127,8 @@ class CameraController(
125
127
  imageAnalysis = if (enableDetection) {
126
128
  Log.d(TAG, "[BIND] Creating ImageAnalysis use case...")
127
129
  ImageAnalysis.Builder()
128
- .setTargetResolution(Size(720, 1280))
130
+ // Use aspect ratio to avoid unsupported size combinations on some devices.
131
+ .setTargetAspectRatio(AspectRatio.RATIO_4_3)
129
132
  .setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
130
133
  .setOutputImageFormat(ImageAnalysis.OUTPUT_IMAGE_FORMAT_YUV_420_888)
131
134
  .build()
@@ -77,14 +77,14 @@ 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) for better React Native compatibility
81
- implementationMode = PreviewView.ImplementationMode.COMPATIBLE
80
+ // Use PERFORMANCE (SurfaceView) - more reliable for camera preview
81
+ implementationMode = PreviewView.ImplementationMode.PERFORMANCE
82
82
  visibility = View.VISIBLE
83
83
  keepScreenOn = true
84
84
  // Force view to be drawn
85
85
  setWillNotDraw(false)
86
- // Set a higher z-order to ensure it's visible
87
- z = 0f
86
+ // Ensure the view is on top
87
+ bringToFront()
88
88
  requestLayout()
89
89
  }
90
90
  Log.d(TAG, "[INIT] PreviewView created: $previewView")
@@ -99,8 +99,8 @@ class DocumentScannerView(context: ThemedReactContext) : FrameLayout(context), L
99
99
  Log.d(TAG, "[INIT] Creating OverlayView...")
100
100
  overlayView = OverlayView(context).apply {
101
101
  layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
102
- // Set higher z-order than preview to be drawn on top
103
- z = 1f
102
+ // Ensure overlay is drawn on top
103
+ bringToFront()
104
104
  }
105
105
  Log.d(TAG, "[INIT] OverlayView created: $overlayView")
106
106
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "3.184.0",
3
+ "version": "3.188.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",