react-native-barcode-scanner-fabric
v0.1.20
Published
test
Downloads
9
Readme
react-native-barcode-scanner
qr code scanner for react native
Installation
npm install react-native-barcode-scanner
// config scan file module inside MainApplication.java
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
packages.add(new ScanQRFilePackage());
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
Usage
import { BarcodeScannerView } from "react-native-barcode-scanner";
import { TouchableOpacity } from 'react-native';
import { scan } from 'react-native-barcode-scanner';
// supported formats: 'AZTEC' | 'CODABAR' | 'CODE_39'| 'CODE_93'| 'CODE_128' | 'DATA_MATRIX' | 'EAN_8' |'EAN_13' | 'ITF' | 'MAXICODE' |'PDF_417'| 'QR_CODE'| 'RSS_14' | 'RSS_EXPANDED' | 'UPC_A' | 'UPC_E' | 'UPC_EAN_EXTENSION'
// ...
<BarcodeScannerView
flashModeEnabled
autoFocusEnabled
frameBorderColor="#eb4034"
acceptFormats={
{
acceptedFormats : ['QR_CODE','PDF_417']
}
}
style={styles.box}
onScanResultListener={(scanEvent) => {
// result value
console.log(`Result: ${scanEvent.nativeEvent.value} `);
}}
<TouchableOpacity onPress= {async ()=>
{
const result = await scan("test")
console.log(`scanResult :${result}`)
}
}>
<Text>Scan Test Image</Text>
</TouchableOpacity>
/>
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT