App Bridge Scanner API | Back button does not work correctly.

Shopify Partner
1 0 0

Hi all,

I posted an issue here but I haven't had any response:

Using this API:

In the mobile app if you trigger opening the scanner, say with a button press, but do not scan a barcode. And you click the back button at the top left of the screen to close the scanner, the next time the app opens the scanner, 2 scanners will open. This continues, if you close those 2 by pressing back and open another, 3 will open.

WhatsApp Image 2024-05-16 at 12.47.45.jpeg

To Reproduce

Steps to reproduce the behaviour:


1. Run a simple app for example:


import { Button } from '@shopify/polaris';

export default function TestForm() {
return (
    onClick={async () => {
      try {
        const payload = await shopify.scanner.capture();
        console.log('Scanner success', payload);
      } catch (error) {
        console.log('Scanner error', error);
    >press me</Button>

2. click the "press me" button to see the scanner open.
3. Do not scan a barcode, just click back at the top left to close the scanner.
4. click the "press me" button again
5. you'll see 2 scanning windows open, scanning a barcode only closes 1 of them, pressing back only closes one of them (and subsequently opens an additional scanner).


Expected behavior

Clicking back should close the scanner as opposed to be what seems like minimizing it. Expected behavior is to not have multiple scan windows open, always one.

The app quickly becomes unusable after closing the barcode scanner a few times which is too common of an operation to ignore.

I guess my question is, how do I go about getting this fixed?

Replies 0 (0)