1.0.3 • Published 3 years ago

qrx-scanner v1.0.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

qrx-scanner

QR code scanning component for React based on jsQR and react-webcam libraries.

Install

npm install qrx-scanner

Demo

https://qrx-scanner.ddns.net/

git clone https://github.com/thylacinus-official/qrx-scanner .
npm install
npm run demo # https://localhost:8080/

Usage

import React from 'react';
import QRScanner from 'qrx-scanner';

const QRScannerComponent = () => <QRScanner />;

Props

NameTypeDefault
autoStartbooleantrue
callbackfunction(img: ImageData) => void
cursorClassNamestring
cursorResolutionnumber400
fullScreenbooleanfalse
minCursorSizenumber0.4
onFailedfunction(error: Error) => void
onSuccessfunction(res: QRCode) => void
timeoutnumber30000
videoSize'contain' | 'cover'contain
webcamPropsPartial\<WebcamProps>defaultWebcamProps

defaultWebcamProps

const defaultWebcamProps = {
    videoConstraints: {
        facingMode: { exact: 'environment' },
        height: 1080,
    },
};

Methods

NameArgsRes
handleResizevoid
scanScanParamsPromise<QRCode | null>

ScanParams

type ScanParams = {
    callback?: (img: ImageData) => void;
    silent?: boolean;
    timeout?: number;
};

Properties

NameType
loadedboolean