1.2.10 • Published 2 months ago

@alexpuertasr/react-qr-scanner v1.2.10

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Features

  • Scan Qr Codes using a smartphone camera or webcam.

Demo

Checkout the Demo.

Install

yarn add @yudiel/react-qr-scanner

npm install @yudiel/react-qr-scanner

Usage

import {QrScanner} from '@yudiel/react-qr-scanner';

const App = () => {
  return (
      <QrScanner
          onDecode={(result) => console.log(result)}
          onError={(error) => console.log(error?.message)}
      />
  );
}

Supported Formats

1D product1D industrial2D
UPC-ACode 39QR Code
EAN-8Code 128Data Matrix
EAN-13RSS-14Aztec
PDF 417

Limitations

  • Due to browser implementations the camera can only be accessed over https or localhost.
  • Server side rendering won't work so only require the component when rendering in a browser environment.

API

PropertiesTypesDefault ValueDescription
constraintsMediaTrackConstraints{ facingMode: 'environment' }Specify which camera should be used (if available).
containerStyleobjectnoneStyle object for the container element.
videoStyleobjectnoneStyle object for the video element.
scanDelaynumber500The scan period for the QR hook.
videoIdstringvideoIdThe Id for the video element.
onResultfunctionnoneScan event handler for result object.
onDecodefunctionnoneScan event handler for decode value.
onErrorfunctionnoneScan event handler for error object.
ViewFindercomponentnoneViewFinder component to rendering as overlay in the video element
hideCountbooleantrueHide the scanned count as overlay in the video element
stopDecodingbooleanfalseStop the decoding process
1.2.10

2 months ago