A SnapScanner is used to scan any QR code
, Bar Code
, UPI QR Code
from an image. You just need to pass an image
, the component will scan
the image
and provide you the QR code ID
, Bar code ID
or UPI ID
A minimal Demo Link
Value | Used as a | Description |
---|---|---|
SnapScanner | ✅ Component | Can be used as Component |
snapScanner | ✅ Service | Can be used as Service |
// Default import will return SnapScanner Component
import SnapScanner from 'fe-pilot/SnapScanner';
<SnapScanner /> // Used as a Component
import { SnapScanner, snapScanner } from 'fe-pilot/SnapScanner';
<SnapScanner /> // Used as a Component
snapScanner(); // Used as a Service
import { SnapScanner } from 'fe-pilot/SnapScanner';
const successCb = (response) => {
console.log("success response:", response);
}
const failureCb = (response) => {
console.log("failure response:", response);
}
return (
<SnapScanner successCb={successCb} failureCb={failureCb}>
Pass clickable element (button, anchor etc) here to bind onClick event
</SnapScanner>
);
Props | Type | Description | Response |
---|---|---|---|
successCb | Function | It will be called on success |
{ data: "Can be array/object/string/number", msgType: "SUCCESSFUL", msg: "A success msg", status: "SUCCESS" } |
loadingCb | Function | It will be called before success/failure. |
{ msgType: "LOADING", msg: "LOADING...", status: "LOADING" } |
failureCb | Function | It will be called on failure |
{ msgType: "ERROR", msg: "A failed msg", status: "FAILURE" } |
Props | Type | Description | Default Values |
showForever | Boolean | To hide/remove unsupported feature, make it false. | Default value is true. |
via | String | To open gallary/Phone Camera/File System | Default value is gallery. Possible values are gallary/camera/phone |