Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
react-scan-qr-code
Advanced tools
You need a scanner component for Scanning QR codes from a web browser based app.
This component has been tested in the following browsers:
Since this library does internal use of hooks you need React >= 16.8.0
.
You can install this library via NPM or YARN.
npm i react-scan-qr-code
yarn add react-scan-qr-code
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 { QrScanner } from 'react-scan-qr-code';
const Test = (props) => {
const [data, setData] = useState('No result');
return (
<>
<QrScanner
onsuccess={(result, error) => {
if (!!result) {
setData(result);
}
if (!!error) {
console.info(error.message);
}
}}
style={{ width: '100%' }}
/>
<p>{data}</p>
</>
);
};
The QrCodeScanner
component has the following props:
Properties | Types | Default Value | Description |
---|---|---|---|
constraints | MediaTrackConstraints | { facingMode: 'user' } | Specify which camera should be used (if available). |
onSuccess | function | none | Scan event handler |
videoId | string | video | The ID for the video element |
scanDelay | number | 500 | The scan period for the QR hook |
ViewFinder | component | none | ViewFinder component to rendering over the video element |
className | string | none | ClassName for the container element. |
containerStyle | object | none | Style object for the container element. |
videoContainerStyle | object | none | Style object for the video container element. |
videoStyle | object | none | Style object for the video element. |
Distributed under the MIT license. See LICENSE for more information.
FAQs
A React Component for scanning QR codes from the webcam
The npm package react-scan-qr-code receives a total of 12 weekly downloads. As such, react-scan-qr-code popularity was classified as not popular.
We found that react-scan-qr-code demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.