Skip to content

Not Getting All QRCodes on screen #61

@ravindraguptacapgemini

Description

@ravindraguptacapgemini

Before submitting a new issue

  • I tested using the latest version of the library, as the bug might be already fixed.
  • I tested using a supported version of react native.
  • I checked for possible duplicate issues, with possible answers.

Bug summary

With latest release, we only get one QRCode, even if there are multiple QRCode in front of camera. Ideally we should either trigger multiple events for each qrcode or send all of them in one callback.
Root cause:

guard let results = request.results as? [VNBarcodeObservation],
                       let firstBarcode = results.first,
                       let payloadString = firstBarcode.payloadStringValue
                   else {
                       return
                   }

we only use first from result and discard others, @pushpender-singh-ap can you please update the code accordingly. Thanks

Library version

2.0.1

Environment info

System:
  OS: macOS 15.7.2
  CPU: (12) arm64 Apple M2 Pro
  Memory: 2.63 GB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.19.4
    path: /usr/local/bin/node
  Yarn:
    version: 3.6.4
    path: ~/node_modules/.bin/yarn
  npm:
    version: 10.8.2
    path: /usr/local/bin/npm
  Watchman:
    version: 2024.11.25.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /Users/ravindragupta/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK:
    API Levels:
      - "24"
      - "28"
      - "31"
      - "33"
      - "34"
      - "35"
      - "36"
    Build Tools:
      - 27.0.3
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 32.0.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
      - 35.0.0
      - 36.0.0
    System Images:
      - android-23 | Google APIs Intel x86 Atom
      - android-24 | Google APIs Intel x86 Atom
      - android-26 | ARM 64 v8a
      - android-26 | Google APIs ARM 64 v8a
      - android-26 | Google APIs Intel x86 Atom
      - android-28 | Google ARM64-V8a Play ARM 64 v8a
      - android-30 | Google APIs ARM 64 v8a
      - android-30 | Google Play ARM 64 v8a
      - android-31 | Google Play ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
      - android-35 | Google Play Tablet ARM 64 v8a
      - android-36 | Google APIs ARM 64 v8a
      - android-36 | Pre-Release 16 KB Page Size Google Play ARM 64 v8a
      - android-36 | Pre-Release 16 KB Page Size Google Play Intel x86_64 Atom
    Android NDK: Not Found
IDEs:
  Android Studio: 2025.1 AI-251.26094.121.2513.14007798
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 21.0.1
    path: /usr/bin/javac
  Ruby:
    version: 3.1.4
    path: /Users/ravindragupta/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.0.0
    wanted: 20.0.0
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.81.4
    wanted: 0.81.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Steps to reproduce

  1. Place multiple QRCode on screen
  2. See if you can receive all of the QRCodes in response in callback for startScanning

Reproducible example repository

https://github.com/pushpender-singh-ap/react-native-scanner/issues

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions