Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
react-qr-scanner-throne-fork
Advanced tools
A react component for reading QR codes from the webcam.
A React component for reading QR codes from the webcam. It uses the WebRTC standards for reading webcam data and jsQR is used for detecting QR codes in that data. To optimise the speed and experience, a web-worker is used to offload the heavy QR code algorithm on a separate process. The web worker is inlined and loaded on creation of the component. Thanks to initial repo https://github.com/JodusNodus/react-qr-reader
kybarg.github.io/react-qr-scanner/
legacyMode
to support these platforms.facingMode
will not affect it.npm install --save react-qr-scanner
import React, { Component } from 'react'
import QrReader from 'react-qr-scanner'
class Test extends Component {
constructor(props){
super(props)
this.state = {
delay: 100,
result: 'No result',
}
this.handleScan = this.handleScan.bind(this)
}
handleScan(data){
this.setState({
result: data,
})
}
handleError(err){
console.error(err)
}
render(){
const previewStyle = {
height: 240,
width: 320,
}
return(
<div>
<QrReader
delay={this.state.delay}
style={previewStyle}
onError={this.handleError}
onScan={this.handleScan}
/>
<p>{this.state.result}</p>
</div>
)
}
}
onScan
Type: function
, Required, Argument: result
Scan event handler. Called every scan with the decoded value or null
if no QR code was found.
onError
Type: function
, Required, Argument: error
Function to call when an error occurs such as:
onLoad
Type: function
, Optional
Called when the component is ready for use.
onImageLoad
Type: function
, Optional, Argument: React img onLoad event
Called when the image in legacyMode is loaded.
delay
Type: number
, Optional, Default: 500
The delay between scans in milliseconds. To disable the interval pass in false
.
facingMode
Type: string
, Optional
Specify which camera direction should be used (if available). Options: front
and rear
.
legacyMode
Type: boolean
, Optional, Default: false
.
If the device does not allow camera access (e.g. IOS Browsers, Safari) you can enable legacyMode to allow the user to take a picture (On a mobile device) or use an existing one. To trigger the image dialog just call the method openImageDialog
from the parent component. Warning You must call the method from a user action (eg. click event on some element).
maxImageSize
Type: number
, Optional, Default: 1500
.
If legacyMode
is active then the image will be downscaled to the given value while keepings its aspect ratio. Allowing larger images will increase the accuracy but it will also slow down the processing time.
style
Type: object
, Optional
Styling for the preview element. This will be a video
or an img
when legacymode
is true
. Warning The preview will keep its aspect ratio, to disable this set the CSS property objectFit to fill
.
className
Type: string
, Optional
ClassName for the container element.
chooseDeviceId
Type: function
, Optional, Arguments: (1) video devices matching facingMode
, (2) all video devices
Called when choosing which device to use for scanning. By default chooses the first video device matching facingMode
, if no devices match the first video device found is choosen.
initialStream
Type: MediaStream
, Optional
Existing MediaStream to use initially.
npm install
npm run build
npm run storybook
npm test
npm run lint
The MIT License (MIT)
Copyright (c) 2017 Thomas Billiet
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.
FAQs
A react component for reading QR codes from the webcam.
The npm package react-qr-scanner-throne-fork receives a total of 1 weekly downloads. As such, react-qr-scanner-throne-fork popularity was classified as not popular.
We found that react-qr-scanner-throne-fork 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.