HelloVoter
HelloVoter copied to clipboard
Component to scan a driver's license barcode
As a canvasser I want to be able to scan a driver's license barcode so that data from it can be used to pre-fill fields or be used to verify information so we can implement features such as easy voter registration and voter record validation.
This feature is done when:
- A data type of something name like "id scan" exists and when selected, opens the camera and scans for a driver's license barcode
- The data from the barcode is available to be consumed by a callback function.
Proof-of-concept code uses these libraries:
import { RNCamera } from 'react-native-camera';
import { parse } from 'parse-usdl';
And references the components to capture / parse data like so:
<RNCamera
ref={ref => {this.camera = ref;}}
style={{
flex: 1,
justifyContent: 'space-between',
}}
androidCameraPermissionOptions={{
title: 'Permission to use camera',
message: 'We need your permission to use your camera',
buttonPositive: 'Ok',
buttonNegative: 'Cancel',
}}
onBarCodeRead={(e) => console.warn(parse(e.data))}
barCodeTypes={[RNCamera.Constants.BarCodeType.pdf417]}
>