react-native-pdf417-scanner 1.5.0 → 1.7.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.
@@ -58,6 +58,8 @@ public class PDF417CameraView extends TextureView implements TextureView.Surface
58
58
  private MultiFormatReader multiFormatReader;
59
59
  private CameraReadyListener cameraReadyListener;
60
60
  private ScanResultListener scanResultListener;
61
+ private long lastProcessTime = 0;
62
+ private static final long PROCESS_INTERVAL_MS = 50; // Process every 50ms for better responsiveness
61
63
 
62
64
  public interface CameraReadyListener {
63
65
  void onCameraReady();
@@ -93,8 +95,29 @@ public class PDF417CameraView extends TextureView implements TextureView.Surface
93
95
  private void setupBarcodeReader() {
94
96
  multiFormatReader = new MultiFormatReader();
95
97
  Map<DecodeHintType, Object> hints = new EnumMap<>(DecodeHintType.class);
96
- hints.put(DecodeHintType.POSSIBLE_FORMATS, EnumSet.of(BarcodeFormat.PDF_417));
98
+
99
+ // Enable all barcode formats for maximum compatibility
100
+ hints.put(DecodeHintType.POSSIBLE_FORMATS, EnumSet.of(
101
+ BarcodeFormat.PDF_417,
102
+ BarcodeFormat.DATA_MATRIX,
103
+ BarcodeFormat.QR_CODE,
104
+ BarcodeFormat.AZTEC,
105
+ BarcodeFormat.CODE_128,
106
+ BarcodeFormat.CODE_39,
107
+ BarcodeFormat.CODABAR
108
+ ));
109
+
110
+ // Enhanced scanning hints for lengthy and dense barcodes
97
111
  hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
112
+ hints.put(DecodeHintType.PURE_BARCODE, Boolean.FALSE);
113
+ hints.put(DecodeHintType.ALSO_INVERTED, Boolean.TRUE);
114
+
115
+ // Character set for international cards
116
+ hints.put(DecodeHintType.CHARACTER_SET, "UTF-8");
117
+
118
+ // Allow partial decoding for lengthy barcodes
119
+ hints.put(DecodeHintType.ASSUME_GS1, Boolean.FALSE);
120
+
98
121
  multiFormatReader.setHints(hints);
99
122
  }
100
123
 
@@ -137,6 +160,61 @@ public class PDF417CameraView extends TextureView implements TextureView.Surface
137
160
  Log.d(TAG, "Stopped scanning");
138
161
  }
139
162
 
163
+ public void triggerAutoFocus() {
164
+ if (captureSession != null && cameraDevice != null) {
165
+ try {
166
+ // Enhanced autofocus for barcode scanning
167
+ CaptureRequest.Builder builder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
168
+ builder.addTarget(new Surface(getSurfaceTexture()));
169
+ builder.addTarget(imageReader.getSurface());
170
+
171
+ // Trigger AF with enhanced settings
172
+ builder.set(CaptureRequest.CONTROL_AF_TRIGGER, CaptureRequest.CONTROL_AF_TRIGGER_START);
173
+ builder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_AUTO);
174
+
175
+ // Enhanced focus settings for barcode scanning
176
+ builder.set(CaptureRequest.LENS_FOCUS_DISTANCE, 0.0f); // Start with infinity
177
+ builder.set(CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER, CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER_START);
178
+
179
+ // Apply enhanced image quality settings during focus
180
+ builder.set(CaptureRequest.EDGE_MODE, CaptureRequest.EDGE_MODE_HIGH_QUALITY);
181
+ builder.set(CaptureRequest.NOISE_REDUCTION_MODE, CaptureRequest.NOISE_REDUCTION_MODE_HIGH_QUALITY);
182
+ builder.set(CaptureRequest.SHADING_MODE, CaptureRequest.SHADING_MODE_HIGH_QUALITY);
183
+
184
+ captureSession.capture(builder.build(), null, backgroundHandler);
185
+
186
+ // Reset AF trigger after a short delay
187
+ backgroundHandler.postDelayed(() -> {
188
+ try {
189
+ if (captureSession != null && cameraDevice != null) {
190
+ CaptureRequest.Builder resetBuilder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
191
+ resetBuilder.addTarget(new Surface(getSurfaceTexture()));
192
+ resetBuilder.addTarget(imageReader.getSurface());
193
+
194
+ resetBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER, CaptureRequest.CONTROL_AF_TRIGGER_IDLE);
195
+ resetBuilder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
196
+ resetBuilder.set(CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER, CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER_IDLE);
197
+
198
+ // Maintain enhanced quality settings
199
+ resetBuilder.set(CaptureRequest.EDGE_MODE, CaptureRequest.EDGE_MODE_HIGH_QUALITY);
200
+ resetBuilder.set(CaptureRequest.NOISE_REDUCTION_MODE, CaptureRequest.NOISE_REDUCTION_MODE_HIGH_QUALITY);
201
+ resetBuilder.set(CaptureRequest.SHADING_MODE, CaptureRequest.SHADING_MODE_HIGH_QUALITY);
202
+ resetBuilder.set(CaptureRequest.FLASH_MODE, torchEnabled ?
203
+ CaptureRequest.FLASH_MODE_TORCH : CaptureRequest.FLASH_MODE_OFF);
204
+
205
+ captureSession.setRepeatingRequest(resetBuilder.build(), null, backgroundHandler);
206
+ }
207
+ } catch (CameraAccessException e) {
208
+ Log.e(TAG, "Error resetting autofocus", e);
209
+ }
210
+ }, 500); // 500ms delay for focus to complete
211
+
212
+ } catch (CameraAccessException e) {
213
+ Log.e(TAG, "Error triggering autofocus", e);
214
+ }
215
+ }
216
+ }
217
+
140
218
  public void setTorchEnabled(boolean enabled) {
141
219
  this.torchEnabled = enabled;
142
220
  updateTorch();
@@ -299,15 +377,37 @@ public class PDF417CameraView extends TextureView implements TextureView.Surface
299
377
  texture.setDefaultBufferSize(previewSize.getWidth(), previewSize.getHeight());
300
378
  Surface previewSurface = new Surface(texture);
301
379
 
302
- // Setup ImageReader for barcode scanning
380
+ // Setup ImageReader for barcode scanning with optimal resolution
303
381
  setupImageReader();
304
382
 
305
383
  CaptureRequest.Builder builder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
306
384
  builder.addTarget(previewSurface);
307
385
  builder.addTarget(imageReader.getSurface());
308
386
 
387
+ // Enhanced camera settings for barcode scanning
309
388
  builder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
310
389
  builder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON);
390
+ builder.set(CaptureRequest.CONTROL_AWB_MODE, CaptureRequest.CONTROL_AWB_MODE_AUTO);
391
+
392
+ // Optimize for document/barcode scanning
393
+ builder.set(CaptureRequest.CONTROL_SCENE_MODE, CaptureRequest.CONTROL_SCENE_MODE_BARCODE);
394
+ builder.set(CaptureRequest.CONTROL_VIDEO_STABILIZATION_MODE, CaptureRequest.CONTROL_VIDEO_STABILIZATION_MODE_ON);
395
+
396
+ // Enhanced image quality for better barcode detection
397
+ builder.set(CaptureRequest.EDGE_MODE, CaptureRequest.EDGE_MODE_HIGH_QUALITY);
398
+ builder.set(CaptureRequest.NOISE_REDUCTION_MODE, CaptureRequest.NOISE_REDUCTION_MODE_HIGH_QUALITY);
399
+ builder.set(CaptureRequest.SHADING_MODE, CaptureRequest.SHADING_MODE_HIGH_QUALITY);
400
+ builder.set(CaptureRequest.COLOR_CORRECTION_MODE, CaptureRequest.COLOR_CORRECTION_MODE_HIGH_QUALITY);
401
+
402
+ // Focus settings for sharp barcode capture
403
+ builder.set(CaptureRequest.LENS_FOCUS_DISTANCE, 0.0f); // Infinity focus for documents
404
+ builder.set(CaptureRequest.CONTROL_AF_TRIGGER, CaptureRequest.CONTROL_AF_TRIGGER_IDLE);
405
+
406
+ // Exposure and ISO settings for consistent lighting
407
+ builder.set(CaptureRequest.CONTROL_AE_EXPOSURE_COMPENSATION, 0);
408
+ builder.set(CaptureRequest.CONTROL_AE_LOCK, false);
409
+
410
+ // Set flash mode
311
411
  builder.set(CaptureRequest.FLASH_MODE, torchEnabled ?
312
412
  CaptureRequest.FLASH_MODE_TORCH : CaptureRequest.FLASH_MODE_OFF);
313
413
 
@@ -324,7 +424,7 @@ public class PDF417CameraView extends TextureView implements TextureView.Surface
324
424
  try {
325
425
  CaptureRequest request = builder.build();
326
426
  session.setRepeatingRequest(request, null, backgroundHandler);
327
- Log.d(TAG, "Camera preview started successfully");
427
+ Log.d(TAG, "Camera preview started successfully with enhanced settings");
328
428
  if (cameraReadyListener != null) {
329
429
  cameraReadyListener.onCameraReady();
330
430
  }
@@ -353,10 +453,24 @@ public class PDF417CameraView extends TextureView implements TextureView.Surface
353
453
  }
354
454
 
355
455
  private void setupImageReader() {
356
- imageReader = ImageReader.newInstance(previewSize.getWidth(), previewSize.getHeight(),
357
- ImageFormat.YUV_420_888, 2);
456
+ // Use optimal resolution for barcode scanning
457
+ Size scanSize = chooseBestScanSize();
458
+ imageReader = ImageReader.newInstance(scanSize.getWidth(), scanSize.getHeight(),
459
+ ImageFormat.YUV_420_888, 5); // Increased buffer for better processing
358
460
  imageReader.setOnImageAvailableListener(onImageAvailableListener, backgroundHandler);
359
461
  }
462
+
463
+ private Size chooseBestScanSize() {
464
+ // For lengthy barcodes, we need higher resolution
465
+ if (previewSize.getWidth() > 2560 || previewSize.getHeight() > 1440) {
466
+ return new Size(2560, 1440); // 4K support for very detailed barcodes
467
+ } else if (previewSize.getWidth() > 1920 || previewSize.getHeight() > 1080) {
468
+ return new Size(1920, 1080); // Full HD for detailed barcodes
469
+ } else if (previewSize.getWidth() < 1280 || previewSize.getHeight() < 720) {
470
+ return new Size(1280, 720); // Minimum HD for basic scanning
471
+ }
472
+ return previewSize;
473
+ }
360
474
 
361
475
  private final ImageReader.OnImageAvailableListener onImageAvailableListener =
362
476
  new ImageReader.OnImageAvailableListener() {
@@ -364,6 +478,18 @@ public class PDF417CameraView extends TextureView implements TextureView.Surface
364
478
  public void onImageAvailable(ImageReader reader) {
365
479
  if (!isScanning) return;
366
480
 
481
+ // Throttle processing to avoid overwhelming the CPU
482
+ long currentTime = System.currentTimeMillis();
483
+ if (currentTime - lastProcessTime < PROCESS_INTERVAL_MS) {
484
+ // Skip this frame
485
+ Image image = reader.acquireLatestImage();
486
+ if (image != null) {
487
+ image.close();
488
+ }
489
+ return;
490
+ }
491
+ lastProcessTime = currentTime;
492
+
367
493
  Image image = reader.acquireLatestImage();
368
494
  if (image != null) {
369
495
  try {
@@ -377,23 +503,279 @@ public class PDF417CameraView extends TextureView implements TextureView.Surface
377
503
 
378
504
  private void processImage(Image image) {
379
505
  try {
380
- ByteBuffer buffer = image.getPlanes()[0].getBuffer();
381
- byte[] data = new byte[buffer.remaining()];
382
- buffer.get(data);
383
-
384
- PlanarYUVLuminanceSource source = new PlanarYUVLuminanceSource(
385
- data, image.getWidth(), image.getHeight(), 0, 0,
386
- image.getWidth(), image.getHeight(), false);
387
-
388
- BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
389
- Result result = multiFormatReader.decode(bitmap);
506
+ // Get image dimensions
507
+ int width = image.getWidth();
508
+ int height = image.getHeight();
509
+
510
+ // Extract Y plane (luminance) from YUV_420_888
511
+ Image.Plane yPlane = image.getPlanes()[0];
512
+ ByteBuffer yBuffer = yPlane.getBuffer();
513
+ int ySize = yBuffer.remaining();
514
+ byte[] yData = new byte[ySize];
515
+ yBuffer.get(yData);
516
+
517
+ // Enhanced processing for lengthy and dense barcodes
518
+ Result result = null;
519
+
520
+ // Approach 1: Full image with enhanced preprocessing
521
+ result = tryDecodeWithEnhancedProcessing(yData, width, height, 0, 0, width, height);
522
+
523
+ // Approach 2: Horizontal strips for lengthy barcodes (like Canadian health cards)
524
+ if (result == null) {
525
+ result = tryHorizontalStrips(yData, width, height);
526
+ }
527
+
528
+ // Approach 3: Vertical strips for rotated lengthy barcodes
529
+ if (result == null) {
530
+ result = tryVerticalStrips(yData, width, height);
531
+ }
532
+
533
+ // Approach 4: Center crop with different sizes
534
+ if (result == null) {
535
+ result = tryMultipleCrops(yData, width, height);
536
+ }
537
+
538
+ // Approach 5: Enhanced rotation detection
539
+ if (result == null) {
540
+ result = tryEnhancedRotation(yData, width, height);
541
+ }
542
+
543
+ // Approach 6: Scale variations for different densities
544
+ if (result == null) {
545
+ result = tryScaleVariations(yData, width, height);
546
+ }
390
547
 
391
548
  if (result != null && scanResultListener != null) {
392
- Log.d(TAG, "PDF417 barcode detected: " + result.getText());
549
+ Log.d(TAG, "Barcode detected: " + result.getBarcodeFormat() + " - Length: " + result.getText().length());
393
550
  scanResultListener.onScanResult(result.getText(), result.getBarcodeFormat().toString());
394
551
  }
395
552
  } catch (Exception e) {
396
- // No barcode found, continue scanning
553
+ Log.d(TAG, "No barcode found in frame: " + e.getMessage());
554
+ }
555
+ }
556
+
557
+ private Result tryDecodeWithEnhancedProcessing(byte[] yData, int dataWidth, int dataHeight,
558
+ int left, int top, int width, int height) {
559
+ try {
560
+ // Create luminance source
561
+ PlanarYUVLuminanceSource source = new PlanarYUVLuminanceSource(
562
+ yData, dataWidth, dataHeight, left, top, width, height, false);
563
+
564
+ // Try multiple binarization approaches
565
+ Result result = null;
566
+
567
+ // 1. HybridBinarizer (best for mixed content)
568
+ BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
569
+ try {
570
+ result = multiFormatReader.decode(bitmap);
571
+ if (result != null) return result;
572
+ } catch (Exception e) { /* Continue to next approach */ }
573
+
574
+ // 2. GlobalHistogramBinarizer (best for uniform lighting)
575
+ bitmap = new BinaryBitmap(new com.google.zxing.common.GlobalHistogramBinarizer(source));
576
+ try {
577
+ result = multiFormatReader.decode(bitmap);
578
+ if (result != null) return result;
579
+ } catch (Exception e) { /* Continue to next approach */ }
580
+
581
+ // 3. Try with inverted source for negative barcodes
582
+ PlanarYUVLuminanceSource invertedSource = new PlanarYUVLuminanceSource(
583
+ invertYUVData(yData, width * height), dataWidth, dataHeight, left, top, width, height, false);
584
+
585
+ bitmap = new BinaryBitmap(new HybridBinarizer(invertedSource));
586
+ try {
587
+ result = multiFormatReader.decode(bitmap);
588
+ if (result != null) return result;
589
+ } catch (Exception e) { /* Continue */ }
590
+
591
+ return null;
592
+ } catch (Exception e) {
593
+ return null;
594
+ }
595
+ }
596
+
597
+ private Result tryHorizontalStrips(byte[] yData, int width, int height) {
598
+ // Scan in horizontal strips for lengthy horizontal barcodes
599
+ int stripHeight = height / 5; // 5 horizontal strips
600
+
601
+ for (int i = 0; i < 5; i++) {
602
+ int stripTop = i * stripHeight;
603
+ if (stripTop + stripHeight > height) stripHeight = height - stripTop;
604
+
605
+ Result result = tryDecodeWithEnhancedProcessing(yData, width, height,
606
+ 0, stripTop, width, stripHeight);
607
+ if (result != null) return result;
608
+ }
609
+
610
+ // Try overlapping strips
611
+ stripHeight = height / 3;
612
+ for (int i = 0; i < 4; i++) {
613
+ int stripTop = i * stripHeight / 2;
614
+ if (stripTop + stripHeight > height) stripHeight = height - stripTop;
615
+
616
+ Result result = tryDecodeWithEnhancedProcessing(yData, width, height,
617
+ 0, stripTop, width, stripHeight);
618
+ if (result != null) return result;
619
+ }
620
+
621
+ return null;
622
+ }
623
+
624
+ private Result tryVerticalStrips(byte[] yData, int width, int height) {
625
+ // Scan in vertical strips for lengthy vertical barcodes
626
+ int stripWidth = width / 5; // 5 vertical strips
627
+
628
+ for (int i = 0; i < 5; i++) {
629
+ int stripLeft = i * stripWidth;
630
+ if (stripLeft + stripWidth > width) stripWidth = width - stripLeft;
631
+
632
+ Result result = tryDecodeWithEnhancedProcessing(yData, width, height,
633
+ stripLeft, 0, stripWidth, height);
634
+ if (result != null) return result;
635
+ }
636
+
637
+ return null;
638
+ }
639
+
640
+ private Result tryMultipleCrops(byte[] yData, int width, int height) {
641
+ // Try different crop sizes for various barcode densities
642
+ float[] cropFactors = {0.9f, 0.8f, 0.7f, 0.6f, 0.5f};
643
+
644
+ for (float factor : cropFactors) {
645
+ int cropWidth = (int)(width * factor);
646
+ int cropHeight = (int)(height * factor);
647
+ int cropLeft = (width - cropWidth) / 2;
648
+ int cropTop = (height - cropHeight) / 2;
649
+
650
+ Result result = tryDecodeWithEnhancedProcessing(yData, width, height,
651
+ cropLeft, cropTop, cropWidth, cropHeight);
652
+ if (result != null) return result;
653
+ }
654
+
655
+ return null;
656
+ }
657
+
658
+ private Result tryEnhancedRotation(byte[] yData, int width, int height) {
659
+ try {
660
+ // Try 90-degree rotations with enhanced processing
661
+ int[] rotations = {90, 180, 270};
662
+
663
+ for (int rotation : rotations) {
664
+ byte[] rotatedData = rotateYUVEnhanced(yData, width, height, rotation);
665
+ int newWidth = (rotation == 90 || rotation == 270) ? height : width;
666
+ int newHeight = (rotation == 90 || rotation == 270) ? width : height;
667
+
668
+ Result result = tryDecodeWithEnhancedProcessing(rotatedData, newWidth, newHeight,
669
+ 0, 0, newWidth, newHeight);
670
+ if (result != null) return result;
671
+ }
672
+
673
+ return null;
674
+ } catch (Exception e) {
675
+ return null;
676
+ }
677
+ }
678
+
679
+ private Result tryScaleVariations(byte[] yData, int width, int height) {
680
+ try {
681
+ // Try different scaling for high/low density barcodes
682
+ float[] scales = {1.5f, 0.75f, 0.5f};
683
+
684
+ for (float scale : scales) {
685
+ byte[] scaledData = scaleYUVData(yData, width, height, scale);
686
+ int newWidth = (int)(width * scale);
687
+ int newHeight = (int)(height * scale);
688
+
689
+ if (newWidth > 0 && newHeight > 0 && scaledData != null) {
690
+ Result result = tryDecodeWithEnhancedProcessing(scaledData, newWidth, newHeight,
691
+ 0, 0, newWidth, newHeight);
692
+ if (result != null) return result;
693
+ }
694
+ }
695
+
696
+ return null;
697
+ } catch (Exception e) {
698
+ return null;
699
+ }
700
+ }
701
+
702
+ private byte[] invertYUVData(byte[] data, int length) {
703
+ byte[] inverted = new byte[data.length];
704
+ System.arraycopy(data, 0, inverted, 0, data.length);
705
+
706
+ // Invert only the Y (luminance) component
707
+ for (int i = 0; i < length; i++) {
708
+ inverted[i] = (byte)(255 - (inverted[i] & 0xFF));
709
+ }
710
+
711
+ return inverted;
712
+ }
713
+
714
+ private byte[] rotateYUVEnhanced(byte[] data, int width, int height, int rotation) {
715
+ if (rotation == 0) return data;
716
+
717
+ byte[] rotated = new byte[data.length];
718
+ int index = 0;
719
+
720
+ // Only rotate the Y component for barcode detection
721
+ int ySize = width * height;
722
+
723
+ switch (rotation) {
724
+ case 90:
725
+ for (int x = 0; x < width; x++) {
726
+ for (int y = height - 1; y >= 0; y--) {
727
+ rotated[index++] = data[y * width + x];
728
+ }
729
+ }
730
+ break;
731
+ case 180:
732
+ for (int y = height - 1; y >= 0; y--) {
733
+ for (int x = width - 1; x >= 0; x--) {
734
+ rotated[index++] = data[y * width + x];
735
+ }
736
+ }
737
+ break;
738
+ case 270:
739
+ for (int x = width - 1; x >= 0; x--) {
740
+ for (int y = 0; y < height; y++) {
741
+ rotated[index++] = data[y * width + x];
742
+ }
743
+ }
744
+ break;
745
+ }
746
+
747
+ // Copy remaining UV data as-is (not used for barcode detection)
748
+ if (data.length > ySize) {
749
+ System.arraycopy(data, ySize, rotated, ySize, data.length - ySize);
750
+ }
751
+
752
+ return rotated;
753
+ }
754
+
755
+ private byte[] scaleYUVData(byte[] data, int width, int height, float scale) {
756
+ try {
757
+ int newWidth = (int)(width * scale);
758
+ int newHeight = (int)(height * scale);
759
+
760
+ if (newWidth <= 0 || newHeight <= 0) return null;
761
+
762
+ byte[] scaled = new byte[newWidth * newHeight];
763
+
764
+ // Simple nearest neighbor scaling for Y component
765
+ for (int y = 0; y < newHeight; y++) {
766
+ for (int x = 0; x < newWidth; x++) {
767
+ int srcX = (int)(x / scale);
768
+ int srcY = (int)(y / scale);
769
+
770
+ if (srcX < width && srcY < height) {
771
+ scaled[y * newWidth + x] = data[srcY * width + srcX];
772
+ }
773
+ }
774
+ }
775
+
776
+ return scaled;
777
+ } catch (Exception e) {
778
+ return null;
397
779
  }
398
780
  }
399
781
 
@@ -67,6 +67,13 @@ public class PDF417CameraViewManager extends SimpleViewManager<PDF417CameraView>
67
67
  view.setTorchEnabled(torchEnabled);
68
68
  }
69
69
 
70
+ @ReactProp(name = "triggerFocus")
71
+ public void setTriggerFocus(PDF417CameraView view, boolean trigger) {
72
+ if (trigger) {
73
+ view.triggerAutoFocus();
74
+ }
75
+ }
76
+
70
77
  @Override
71
78
  public void onDropViewInstance(@NonNull PDF417CameraView view) {
72
79
  view.stopCamera();
package/lib/index.d.ts CHANGED
@@ -13,6 +13,7 @@ export interface PDF417CameraViewProps {
13
13
  isActive?: boolean;
14
14
  isScanning?: boolean;
15
15
  torchEnabled?: boolean;
16
+ triggerFocus?: boolean;
16
17
  onCameraReady?: () => void;
17
18
  onCameraError?: (event: {
18
19
  nativeEvent: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2F,SAAS,EAAE,MAAM,cAAc,CAAC;AAIlI,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,KAAK,IAAI,CAAC;CACrE;AAGD,eAAO,MAAM,gBAAgB,6DAAoE,CAAC;AAElG,cAAM,mBAAmB;IACvB,OAAO,CAAC,YAAY,CAAqB;;IAMzC;;OAEG;IACG,uBAAuB,IAAI,OAAO,CAAC,OAAO,CAAC;IAuBjD;;OAEG;IACG,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC;IAgB7C;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,G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,CAAC,CAAC;QACjF,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,QAA0C;QACpD,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;QAChF,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,QAAoB;QAChC,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;QAClF,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;IACrC,CAAC;CACF;AAED,kBAAe,IAAI,mBAAmB,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-pdf417-scanner",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "React Native SDK for PDF417 barcode scanning with native camera view",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",