Skip to content

Latest commit

 

History

History
162 lines (140 loc) · 3.03 KB

README.md

File metadata and controls

162 lines (140 loc) · 3.03 KB

SnapScanner

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

Demo

A minimal Demo Link

Usage/Examples

Value Used as a Description
SnapScanner ✅ Component Can be used as Component
snapScanner ✅ Service Can be used as Service
1. Here's an example of basic usage with Multiple Import: with Default Import:
// Default import will return SnapScanner Component
import SnapScanner from 'fe-pilot/SnapScanner';

<SnapScanner /> // Used as a Component
2. Here's an example of basic usage with Multiple Import: with Multiple Import:
import { SnapScanner, snapScanner } from 'fe-pilot/SnapScanner';

<SnapScanner /> // Used as a Component

snapScanner(); // Used as a Service
3. Here's an example of a advanced usage:
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

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