react-native-rectangle-doc-scanner 3.147.0 → 3.148.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.
@@ -99,9 +99,10 @@ class CameraView(context: Context) : FrameLayout(context), LifecycleOwner {
99
99
  * Bind camera use cases
100
100
  */
101
101
  private fun bindCamera() {
102
- val lifecycleOwner = when (context) {
103
- is LifecycleOwner -> context as LifecycleOwner
104
- is ThemedReactContext -> context.currentActivity as? LifecycleOwner ?: context as? LifecycleOwner
102
+ val ctx = context
103
+ val lifecycleOwner = when {
104
+ ctx is LifecycleOwner -> ctx
105
+ ctx is ThemedReactContext -> ctx.currentActivity as? LifecycleOwner ?: ctx as? LifecycleOwner
105
106
  else -> null
106
107
  }
107
108
  if (lifecycleOwner == null) {
@@ -207,13 +208,14 @@ class CameraView(context: Context) : FrameLayout(context), LifecycleOwner {
207
208
  onRectangleDetected?.invoke(transformedRectangle)
208
209
  }
209
210
  } catch (e: Exception) {
210
- Log.e(TAG, "Failed to analyze frame", e)
211
- post {
212
- overlayView.setDetectedRectangle(null)
213
- onRectangleDetected?.invoke(null)
211
+ Log.e(TAG, "Failed to analyze frame", e)
212
+ post {
213
+ overlayView.setDetectedRectangle(null)
214
+ onRectangleDetected?.invoke(null)
215
+ }
216
+ } finally {
217
+ imageProxy.close()
214
218
  }
215
- } finally {
216
- imageProxy.close()
217
219
  }
218
220
  }
219
221
 
@@ -225,7 +227,6 @@ class CameraView(context: Context) : FrameLayout(context), LifecycleOwner {
225
227
  cameraExecutor.shutdown()
226
228
  }
227
229
  }
228
- }
229
230
 
230
231
  /**
231
232
  * Overlay view for grid and rectangle
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "3.147.0",
3
+ "version": "3.148.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",