preflower / react-barcode-scanner

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

Demo isn't working #228

Closed desinox closed 2 months ago

desinox commented 2 months ago

First of all, thank you for building a React wrapper for zbar.wasm!

Now, onto the problem: I've tried everything (Chrome/Safari on macOS/iOS), and I even attempted to replicate it in my Next.js app, but I'm not getting any output. I also tried different types of barcodes (Code 128/EAN), but nothing seems to work. Is there currently an issue with the demo?

I hope you can help me, Simon

preflower commented 2 months ago

The demo current only supports qr_code, this is due to my options config, if u wanna support code_128, u need to set formats in options; Here is a demo:

import React from 'react'
import { BarcodeScanner } from 'react-barcode-scanner'
import "react-barcode-scanner/polyfill"

export default () => {
  return (
    <BarcodeScanner options={{ formats: ['code_128'] }} />
  )
}
desinox commented 2 months ago

Oh perfect! Thank you very much