react-native-rectangle-doc-scanner 3.6.0 → 3.8.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "3.6.0",
3
+ "version": "3.8.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -15,9 +15,13 @@
15
15
 
16
16
  - (void)didMoveToWindow {
17
17
  [super didMoveToWindow];
18
- if (self.window) {
18
+ if (self.window && !self.captureSession) {
19
+ // Only setup camera once when view is added to window
19
20
  [self setupCameraView];
20
21
  [self start];
22
+ } else if (!self.window && self.captureSession) {
23
+ // Stop camera when view is removed from window
24
+ [self stop];
21
25
  }
22
26
  }
23
27
 
@@ -70,6 +70,16 @@
70
70
  [[NSNotificationCenter defaultCenter] removeObserver:self];
71
71
  }
72
72
 
73
+ - (void)layoutSubviews
74
+ {
75
+ [super layoutSubviews];
76
+
77
+ // Update GLKView frame to match parent bounds
78
+ if (_glkView) {
79
+ _glkView.frame = self.bounds;
80
+ }
81
+ }
82
+
73
83
  - (void)createGLKView
74
84
  {
75
85
  if (self.context) return;
@@ -313,7 +323,10 @@
313
323
  {
314
324
  _isStopped = NO;
315
325
 
316
- [self.captureSession startRunning];
326
+ // Start camera session on background thread to avoid UI blocking
327
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
328
+ [self.captureSession startRunning];
329
+ });
317
330
 
318
331
  float detectionRefreshRate = _detectionRefreshRateInMS;
319
332
  CGFloat detectionRefreshRateInSec = detectionRefreshRate/100;
@@ -489,7 +502,6 @@
489
502
 
490
503
  - (CIImage *)filteredImageUsingEnhanceFilterOnImage:(CIImage *)image
491
504
  {
492
- [self start];
493
505
  return [CIFilter filterWithName:@"CIColorControls" keysAndValues:kCIInputImageKey, image, @"inputBrightness", @(self.brightness), @"inputContrast", @(self.contrast), @"inputSaturation", @(self.saturation), nil].outputImage;
494
506
  }
495
507