Restrict Scanning Area of Android Barcode Scanner


#1

Using SDK 27

We are using a BarCode Scanner that will sometimes be used to scan a sheet of paper rather than an item that has a barcode attached to it. Due to this we need to restrict the scanning area so that only the barcode in the targeted area is passed to the onBarCodeRead handler. On iOS it seems to be working by just setting the style with a heigh and width and it will interpret barcodes in the center area of the preview screen. With Android it will call onBarCodeRead with a barcode that is not even displayed in the preview region. I’ve tried pretty much everything i could think of but we are still running into this problem any thoughts on restricting the active reading area of the Barcode scanner on Android devices?

Abbreviated Render Script

        <BarCodeScanner
          onBarCodeRead={this._handleBarCodeRead}
          style={{ height: 300, width: 400 }}
          torchMode={flash ? 'on' : 'off'}
        >
...
<View><Text>[        ]</Text></View>
...
</BarCodeScanner>

#2

Hi @yellowdogdevteam - I’m not sure there’s a great way to do this right now (cc @aalices in case I’ve missed something).

There is a feature request here that would probably allow you to do this, so you may want to upvote that.


closed #3

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