Pastel QR Code Scanner & Reader
Pastel QR Code Scanner & Reader is a component built to scan PSL QR codes using a webcam.
Installation
You can install this library via NPM or YARN.
NPM
npm i pastel-qr-scan
YARN
yarn add pastel-qr-scan
Example Usage
After reading and performing the previous steps, you should be able to import the library and use it like in this example:
import React, { useState } from 'react';
import { QrReader } from 'pastel-qr-scan';
const Test = (props) => {
const [data, setData] = useState('No result');
return (
<>
<QrScan
onResult={(result) => {
if (result) {
setData(result?.text);
}
}}
/>
<p>{data}</p>
</>
);
};
Component API
The Pastel QR Code Scanner & Reader
component has the following props:
Properties | Types | Default Value | Description |
---|
onResult | function | none | Scan event handler |
videoWidth | string | 100% | The width for the video element |
videoHeight | string | 100% | The height for the video element |
className | string | none | ClassName for the container element. |
Issues
Please, open an issue following one of the issues templates. We will do our best to fix them.
License
Distributed under the MIT license. See LICENSE for more information.