Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
react-qrcode-scanner
Advanced tools
A React component that provides a simple and efficient way to read QR codes from a web or mobile camera. This lightweight component utilizes HTML canvas to capture images and leverages the jsQR library to detect QR codes within the image data. NOTE: HTTPS is required to use camera on mobile devices. However, you can test over localhost on your computer
npm i react-qrcode-scanner
import React from 'react';
import { QrScanner } from 'react-qrcode-scanner';
function App() {
const handleScan = (value) => {
console.log({ value });
};
const handleError = (error) => {
console.log({ error });
};
return (
<div className='App'>
<QrScanner onScan={handleScan} onError={handleError} />
</div>
);
}
export default App;
Prop Name | Type | Default Value | Description |
---|---|---|---|
onError | Function | (error) => console.log({error}) | Callback function that is called when an error occurs during scanning. |
onScan | Function | (value) => console.log({value}) | Callback function that is called when a QR code is successfully scanned. |
facingMode | String | 'environment' | The facing mode of the camera. Can be set to 'environment' or 'face'. |
constraints | Object | null | The device constraints for the camera. |
onLoad | Function | (val: {mirrorVideo, streamLabel}) => null | Callback function that is called when the component is loaded. |
flipHorizontally | Boolean | false | Determines whether the video output should be flipped or reflected based on the facing mode. |
style | Object | null | Additional styling for the section. |
className | String | null | Additional class names for the section wrapper. |
delay | Number | 800 | The delay between each scan attempt in milliseconds. |
resolution | Number | 600 | The resolution of the canvas in pixels. |
aspectRatio | string | '16:9' | Aspect ratio of the video frame. Default is landscape. Change to '3:4' for portrait |
showViewFinder | Boolean | true | Determines whether to show the viewfinder. |
viewFinder | Object | { border: '12px solid rgba(255,255,255,0.3)', position: 'absolute', borderRadius: '5px', width: '250px', height: '250px' } | Additional CSS styles for the viewfinder element. |
This project is licensed under the MIT License.
FAQs
QR code scanner component for React apps
The npm package react-qrcode-scanner receives a total of 54 weekly downloads. As such, react-qrcode-scanner popularity was classified as not popular.
We found that react-qrcode-scanner demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.