This package has been deprecated

Author message:

Please use react-qr-barcode-scanner instead.

react-webcam-barcode-scanner
TypeScript icon, indicating that this package has built-in type declarations

0.0.2-rc2 • Public • Published

React Webcam Barcode Scanner

This is a simple barebones React component built in Typescript to provide a webcam-based barcode scanner using react-webcam and @zxing/library. This component works on Computers and Mobile Devices (iOS 11 and above and Android Phones).

Installation

npm i react-webcam-barcode-scanner

Usage in React:

A demo of this can be found at: https://barcode.phdash.com.

import React from 'react';
import BarcodeScannerComponent from "react-webcam-barcode-scanner";
 
function App() {
 
  const [ data, setData ] = React.useState('Not Found');
 
  return (
    <>
      <BarcodeScannerComponent
        width={500}
        height={500}
        onUpdate={(err, result) => {
          if (result) setData(result.text)
          else setData('Not Found')
        }}
      />
      <p>{data}</p>
    </>
  )
}
 
export default App;

Package Sidebar

Install

npm i react-webcam-barcode-scanner

Weekly Downloads

882

Version

0.0.2-rc2

License

MIT

Unpacked Size

5.71 kB

Total Files

8

Last publish

Collaborators

  • mrsilver512