1.2.4 • Published 2 years ago

react-scanned-qr v1.2.4

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

react-scanned-qr

React scanner and generator component for QR. Triggers function from both ends when scanned.

Installation


npm

npm i react-scanned-qr

yarn

yarn add react-scanned-qr

Usage/Examples


Important: Add your host name/origin to trigger QRCode component onScanned. > Add your origin

QR Scanner

Note: Scanner does not open camera on localhost. You should host somewhere.

import React from "react";
import { QRScanner } from "react-scanned-qr";

const Example = () => {
  function handleScan(data) {
    console.log(data);
  }

  function handleError(error) {
    console.log(error);
  }

  return (
    <QRScanner
      onScanned={handleScan}
      onError={handleScan}
      style={{
        height: 256,
        width: 256,
      }}
    />
  );
};
QR Code

import React from "react";
import { QRCode } from "react-scanned-qr";

const Example = () => {
  function handleScan(data) {
    console.log(data);
  }

  function handleError(error) {
    console.log(error);
  }

  return (
    <QRCode
      onScanned={handleScan}
      onError={handleScan}
      value={"This is my qr"}
    />
  );
};

API Reference


QR Scanner

ParameterTypeDescription
onScannedfunctionrequired : It returns a data when QR code gets scanned.
onErrorfunctionrequired : It returns a error when something went worng.
onLoadfunctionExecute function passed to this prop when component is loaded.
delaynumberDelay after each scan
facingModestring("user" "environment")Camera mode
videoStyleobjectStyles for video container
videoClassNamestringClassname for video container
showViewFinderbooleanEnable/Disable Showfinder in video
buttonbooleanEnable/Disable for Button
buttonLabelstringText in Button component
buttonStyleobjectStyles for button
buttonClassNamestringClassname for button
loadingComponentElementHTML element for loading

QR Code

ParameterTypeDescription
valuestringrequired : Value for QR
onScannedfunctionrequired : It returns a data when QR code gets scanned.
onErrorfunctionrequired : It returns a error when something went worng.
styleobjectStyles for QR code
classNamestringClassname for QR
bgColorstringBackground color for QR
fgColorstringForeground color for QR
sizenumberSize for QR
levelstring("L" "M" "Q" "H")Error correction level of QR

Support

For support, email at Sanket16warhekar@gmail.com.

Credits

Authors


Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago