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.

barCodeScannerSettings -> barCodeTypes is not work in Android

See original GitHub issue

Summary

Use Camera component with barCodeScannerSettings={{ barCodeTypes: [BarCodeScanner.Constants.BarCodeType.qr] }} to scan QR code, not only QR codes are scanned, but other types of codes are also scanned.

My test device : MI 6 / Android 9

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

Android

SDK Version (managed workflow only)

44

Environment

expo-env-info 1.0.2 environment info: System: OS: Windows 10 10.0.22000 Binaries: Node: 16.13.1 - D:\Environment\Node.js\node.EXE Yarn: 1.22.15 - D:\Environment\Node.js\yarn.CMD npm: 8.5.5 - D:\Environment\Node.js\npm.CMD Expo Workflow: managed

Reproducible demo

import React from "react"
import { Camera } from "expo-scanner"
import { BarCodeScanner } from "expo-barcode-scanner"

const handleBarCodeScanned = ({ data,type }) => {
  console.log(type)
  console.log(data)
}

export const BarcodeScanner = () => (
  <Camera
    type={Camera.Constants.Type.back}
    onBarCodeScanned={handleBarCodeScanned}
   // not work below line
    barCodeScannerSettings={{ barCodeTypes: [BarCodeScanner.Constants.BarCodeType.qr] }}
  />
)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
cfreearcommented, Jun 17, 2022

Also seeing this on a Pixel 6 Pro running Android 12 using this snack:

https://snack.expo.dev/@cfreear/basic-barcodescanner-usage

Its configured to only scan qr and code39 yet I was able to scan the aztec code on wikipedia here:

https://en.wikipedia.org/wiki/Aztec_Code

0reactions
Rehankhalil462commented, Oct 17, 2022

I can confirm the bug, barcodeTypes is not working . It is scanning all types of barcode despite of only mentioned types.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does the scanner / mobile device not read this bar code?
I can't read or scan the bar code with your product. Scanner will not scan barcode. CN51 Android unable to scan PDF417 and...
Read more >
Why Aren't My Barcodes Scanning? 3 Common Problems ...
If your scanner is neither old, nor set to read the incorrect barcode language, your issue may have to do with programming (or...
Read more >
ZXing Android Studio barcode scanner not working with large ...
I have developed an app for reading bar codes ...
Read more >
How to Fix Barcode Scanner Not Working - Lose It! Support
Troubleshooting the Barcode Scanner · Open the Settings app · Apps · Select Lose It! · Permissions · Turn on Camera.
Read more >
Scan barcodes with ML Kit on Android - Google Developers
You can use ML Kit to recognize and decode barcodes. There are two ways to integrate barcode scanning: by bundling the model as...
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