npm.io
1.0.1 • Published 1 year ago

react-native-datawedge

Licence
MIT
Version
1.0.1
Deps
0
Size
48 kB
Vulns
0
Weekly
0

react-native-datawedge

the react-native datawedge lib

Installation

npm install react-native-datawedge

or

yarn add react-native-datawedge

Usage

import { createProfile, useScanner } from 'react-native-datawedge'

Improved Description:
Creates a basic profile on datawedge based on incoming broadcast intent data.

Overwrites existing profiles:
  If a profile with the same name already exists, its configuration is replaced with the new data.
Automatically switches associated app:
  If the app is currently linked to a different profile, it will be automatically reassigned to the newly created profile.


createProfile('ProfileName', 'com.example.SCANNER', false)

Usage

const { scanner, setConfig } = useScanner()


This step is optional as the default configuration will usually suffice.

useEffect(() => {
  setConfig({
    id: "SCANNER_ID",
    canReset: true,
    timeoutToReset: 500
})
}, [])

const DEFAULT_CONFIG: ScannerConfig = {
  canReset: true,
  canScan: true,
  timeOutToReset: 500,
}

If no id is provided, a unique identifier will be generated using React's useId hook.

Using scanner result

useEffect(() => {
  console.log(scanner)
}, [scanner])

License

MIT


Made with create-react-native-library