moaazsidat / react-native-qrcode-scanner

A QR code scanner component for React Native.
MIT License
2.03k stars 513 forks source link

Multiple QR Code at once #247

Open rutvikrockers opened 4 years ago

rutvikrockers commented 4 years ago

I need to scan multiple QR codes at once in one scan. Is it possible for this library? Can you please help me with this?

renatobenks commented 4 years ago

hey, @rutvikrockers, what do you mean with multiples QR codes to scan at once? can you provide us an example of how the QR codes should be represented to scanning?

however, just to let you know in advance, there's no way currently, to scan more than just a single QR code because the scanner just looks on the center of the camera to match a QR code. So, regardless, it will be required a new feature to be built to make this possible.

but I'm pretty confused about how should be this feature because I couldn't even imagine that it would be possible.

igoro00 commented 3 years ago

because the scanner just looks on the center of the camera to match a QR code

It's really doesn't. onRead just passes data from RNCamera's onBarCodeRead callback which scans barcodes... in a very strange order. I did some tests. I printed 3 qr codes on a piece of paper with different data ("25", "42" and "75") near each other.

First, just a regular scan. It picks up the one on the top ("25"). It ignores the mask which, after looking at the code, is just there for decoration. image

Secondly, I covered up the first code. It immiediately picked up the second one with "42" in it. image

Lastly i covered up both codes. It then scanned the last code with "75". Inb4 it's not about the size - it's not like it scanned the one on the top the fastest because its the biggest. On the other side I printed codes with the same size and did exactly the same test and the results didn't vary at all. image

igoro00 commented 3 years ago

The solution MIGHT be to use onGoogleVisionBarcodesDetected instead of onBarCodeRead which outputs an array of barcodes it scanned. Then we would have to somehow filter barcodes that are outside the mask. But then there's a problem: I found that onGoogleVisionBarcodesDetected isn't as reliable as the regular onBarCodeRead - it sometimes looses some barcodes, sometimes its bounds are way off etc.

I studied various react-native scanners for a few days now and im sick of it lol I only need a scanner that scans reliably 1cm*1cm qr codes but only inside the mask. Is that really too much to ask for? 😄

frankbolviken commented 2 years ago

It looks like it was to much to ask :)

Looking for a similar feature as we have parcels which containing multiple barcodes / qr codes and I like to be able to scan them all and pick the one that fits us