question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

barCodeTypes is ignored on Android when type prop is specified on the BarCodeScanner

See original GitHub issue

🐛 Bug Report

Limiting barcode types in expo-barcode-scanner using barCodeTypes doesn’t work on Android (iOS works fine) when type={BarCodeScanner.Constants.Type.back} is specified.

Environment

  Expo CLI 3.13.2 environment info:
    System:
      OS: Linux 5.5 Arch Linux
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 12.16.1 - ~/.nvm/versions/node/v12.16.1/bin/node
      npm: 6.13.4 - ~/.nvm/versions/node/v12.16.1/bin/npm
      Watchman: 4.9.0 - /usr/bin/watchman
    npmPackages:
      expo: ^36.0.0 => 36.0.2 
      react: 16.9.0 => 16.9.0 
      react-native: https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz => 0.61.4 
    npmGlobalPackages:
      expo-cli: 3.13.2

Targets: iOS, Android

Steps to Reproduce

Scan a QR code with barCodeTypes set to BarCodeScanner.Constants.BarCodeType.ean13 and type set to BarCodeScanner.Constants.Type.back with an Android device after reloading the app.

barcodeScanner:

<BarCodeScanner
    type={BarCodeScanner.Constants.Type.back}
    onBarCodeScanned={scanned ? undefined : handleBarcodeScanned}
    barCodeTypes={[BarCodeScanner.Constants.BarCodeType.ean13]}
    style={StyleSheet.absoluteFillObject}
/>

Expected Behavior

Only ean13 barcodes are scanned on both Android and iOS.

Actual Behavior

Non ean13 barcodes are scanned on Android.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
r3b311i0ncommented, May 28, 2020

Apologies. I kind of forgot about this issue. I updated to expo 37.0.0 and specifying type works for me now (also works without type specified).

1reaction
r3b311i0ncommented, Mar 13, 2020

Hey, thanks for the response. I managed to reproduce it with your snack by adding type={BarCodeScanner.Constants.Type.back} and reloading the app.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React native camera not working as expected with expo
The callback is provided with an object of the shape { type: BarCodeScanner.Constants.BarCodeType, data: string } , where the type refers to ...
Read more >
Cognex Mobile Barcode SDK for Android | Using cmbSDK
Enable decoding only for the barcode types the application needs to scan. The cmbSDK supports the decoding of almost 40 different barcode types...
Read more >
BarCodeScanner - Expo Documentation
An array of bar code types. Defaults to all supported bar code types on the platform. Note: Only QR codes are supported on...
Read more >
Creating a Barcode Scanner using Android Studio - Medium
This article will guide you through creating an android application using which you can make use of your mobile camera to scan a...
Read more >
android.device Class ScanManager
android.device. ... Get all values of given scanner configuration properties. ... Reset to factory default settings for all barcode symbology types.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found