Documentation of BarCodeScanner is wrong

Hi, I am doing in my app a qr code scanner and using BarCodeScanner.

I was having a hard time because the function when it finds a barcode, never gets called.

I’m posting this so an admin can fix the docs.

The correct function when the camera finds a barcode isn’t onBarCodeScanned, it is onBarCodeRead

So, the correct way to call it is this:

<BarCodeScanner
   onBarCodeRead={this.handleBarCodeScanned}
   style={StyleSheet.absoluteFill}
/>

Here is the link to the docs:

https://docs.expo.io/versions/latest/sdk/bar-code-scanner

Thanks!
Marco

1 Like

Hey @marcoblbr,

Thanks for reporting this. Relayed it to the docs maintainer. Hopefully we’ll have it fixed soon.

Cheers,

Adam

Thanks for the help! I managed to solve the problem from Expo Snack Barcode Example, which used onBarCodeRead instead of onBarCodeScan and it works fine.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.