Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native Camera Barcode Types

I'm trying to use [email protected] (with [email protected]) to create a QR code scanner. The relevant essentials of my render() method are:

<Camera 
  aspect={Camera.constants.Aspect.fill}
  onBarCodeRead={(data) => console.log(data)} 
  barCodeTypes={['qr']}>
</Camera>

Without the barCodeTypes prop, everything works as expected. But once I include it, the view does not render, and I get the following error message:

*** -[AVCaptureMetadataOutput setMetadataObjectTypes:] Unsupported type found
    - use -availableMetadataObjectTypes

I'm guessing that I just need to write my ['qr'] argument in some other and correct way, but I'm not able to find any information in the documentation.

like image 914
user2421192 Avatar asked Jan 10 '17 01:01

user2421192


1 Answers

Ok, so I found another post on Stack Overflow that helped me figure out the availableMetadataObjectTypes. So to fix my particular problem, I'll just be changing barCodeTypes={['qr']} to barCodeTypes={['org.iso.QRCode']}.

like image 111
user2421192 Avatar answered Dec 16 '22 10:12

user2421192