preflower / react-barcode-scanner

A lightweight React scan library based on modern API
https://reactbarcodescanner.vercel.app/
MIT License
35 stars 4 forks source link

Not working in barcode #292

Open dunghoangpg opened 2 days ago

dunghoangpg commented 2 days ago

Hi, I try to scan the barcode but the plugin does not work, could you please check it? image

preflower commented 2 days ago

Did u config formats option? BarcodeScanner support qr_code format by default, if needed to support other formats, use config formats option;

preflower commented 2 days ago

Related document: https://reactbarcodescanner.vercel.app/docs/guide#barcode-format

dunghoangpg commented 2 days ago

@preflower Yes, added but the camera can't detect barcode <BarcodeScanner onCapture={(e) => setBarCode(e[0]?.rawValue)} options={{formats: ['code_128']}} />

preflower commented 2 days ago

i tried create a demo, and it worked fine; u can try the following path to check problem:

  1. Is polyfill loaded? Barcode Detection API is not work in iOS
  2. Is support wasm in environment? if u use vite, might should add https://reactbarcodescanner.vercel.app/zh-CN/docs/install#vite config;