Skip to content

Conversation

@pushpender-singh-ap
Copy link
Owner

@pushpender-singh-ap pushpender-singh-ap commented Nov 25, 2025

This pull request updates the barcode scanning logic across the codebase to support scanning and returning multiple barcodes at once, instead of just a single barcode. The changes affect the API, callback signatures, and the handling of scan results for both Android and iOS implementations, as well as the TypeScript types and documentation.

API and Type Signature Updates

  • Changed the callback signatures for barcode scanning from accepting a single BarcodeResult to accepting an array of BarcodeResult[] in TypeScript types (src/NativeReactNativeScanner.ts, src/index.tsx) and in native Android and iOS code. [1] [2] [3] [4] [5] [6]

Native Implementation Changes

  • Updated the Android (CameraManager.kt) and iOS (CameraManager.swift, ReactNativeScanner.mm) scanning logic to collect all detected barcodes into an array and invoke the callback with the array, rather than just the first barcode. [1] [2] [3]
  • Adjusted error handling in iOS to return errors as a single-element array for consistency with the new callback signature. [1] [2]

Documentation and Example Updates

  • Updated documentation and example code to reflect the new callback signature and demonstrate handling multiple barcodes. [1] [2] [3] [4]

Type and Interface Renaming

  • Renamed BarcodeScannedEvent to be an array of BarcodeResult and clarified type usage throughout the codebase. [1] [2]

Native Module Imports

  • Added necessary imports for handling arrays in native modules. [1] [2]

These changes ensure that the barcode scanner can now return multiple results per scan, improving flexibility and accuracy for use cases where multiple barcodes may be present.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request updates the barcode scanning API to support returning multiple barcodes per scan instead of just a single barcode. The changes provide more flexibility for use cases where multiple barcodes may be present in the camera view.

Key Changes:

  • Updated callback signatures from (result: BarcodeResult) to (results: BarcodeResult[]) across TypeScript types and native implementations
  • Modified iOS and Android scanning logic to collect and return all detected barcodes as an array
  • Updated documentation and example code to demonstrate handling multiple barcode results

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/NativeReactNativeScanner.ts Refactored types to define BarcodeResult and set BarcodeScannedEvent as an array of results
src/index.tsx Updated BarcodeScannerCallback type and event handling to work with arrays
ios/ReactNativeScanner.mm Changed callback signature from NSDictionary to NSArray to handle multiple results
ios/CameraManager.swift Updated callback types and scanning logic to collect all detected barcodes into an array; modified error handling to return errors as single-element arrays
android/src/main/java/com/pushpendersingh/reactnativescanner/ReactNativeScannerModule.kt Added WritableArray import for handling arrays in native module
android/src/main/java/com/pushpendersingh/reactnativescanner/CameraManager.kt Changed callback type from WritableMap to WritableArray and updated scanning logic to collect all valid barcodes
example/src/App.tsx Updated callback handler to accept and process array of barcode results
README.md Updated API documentation and usage examples to reflect new callback signature
example/ios/Podfile.lock Updated package version checksums

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@pushpender-singh-ap pushpender-singh-ap merged commit a520073 into main Nov 25, 2025
12 checks passed
@pushpender-singh-ap pushpender-singh-ap deleted the fix/61 branch November 25, 2025 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not Getting All QRCodes on screen

1 participant