QR code scanning component for React based on jsQR and react-webcam libraries.
https://qrx-scanner.ddns.net/
git clone https://github.com/thylacinus-official/qrx-scanner .
npm install
npm run demo # https://localhost:8080/
import React from 'react';
import QRScanner from 'qrx-scanner';
const QRScannerComponent = () => <QRScanner />;
Name |
Type |
Default |
autoStart |
boolean |
true |
callback |
function(img: ImageData) => void |
|
cursorClassName |
string |
|
cursorResolution |
number |
400 |
fullScreen |
boolean |
false |
minCursorSize |
number |
0.4 |
onFailed |
function(error: Error) => void |
|
onSuccess |
function(res: QRCode) => void |
|
timeout |
number |
30000 |
videoSize |
'contain' | 'cover' |
contain |
webcamProps |
Partial<WebcamProps> |
defaultWebcamProps |
const defaultWebcamProps = {
videoConstraints: {
facingMode: { exact: 'environment' },
height: 1080,
},
};
Name |
Args |
Res |
handleResize |
|
void |
scan |
ScanParams |
Promise<QRCode | null> |
type ScanParams = {
callback?: (img: ImageData) => void;
silent?: boolean;
timeout?: number;
};