Added barcode types to constants and event metadata

This commit is contained in:
Lochlan Wansbrough 2015-07-02 13:09:35 -07:00
parent e358622ff2
commit 9fee888ab7
2 changed files with 14 additions and 0 deletions

View File

@ -12,6 +12,7 @@ var merge = require('merge');
var constants = {
Aspect: NativeModules.CameraManager.Aspect,
BarCodeType: NativeModules.CameraManager.BarCodeType,
Type: NativeModules.CameraManager.Type,
CaptureMode: NativeModules.CameraManager.CaptureMode,
CaptureTarget: NativeModules.CameraManager.CaptureTarget,

View File

@ -32,6 +32,18 @@ RCT_EXPORT_VIEW_PROPERTY(torchMode, NSInteger);
@"fit": @(RCTCameraAspectFit),
@"fill": @(RCTCameraAspectFill)
},
@"BarCodeType": @{
@"upce": AVMetadataObjectTypeUPCECode,
@"code39": AVMetadataObjectTypeCode39Code,
@"code39mod43": AVMetadataObjectTypeCode39Mod43Code,
@"ean13": AVMetadataObjectTypeEAN13Code,
@"ean8": AVMetadataObjectTypeEAN8Code,
@"code93": AVMetadataObjectTypeCode93Code,
@"code138": AVMetadataObjectTypeCode128Code,
@"pdf417": AVMetadataObjectTypePDF417Code,
@"qr": AVMetadataObjectTypeQRCode,
@"aztec": AVMetadataObjectTypeAztecCode
},
@"Type": @{
@"front": @(RCTCameraTypeFront),
@"back": @(RCTCameraTypeBack)
@ -308,6 +320,7 @@ RCT_EXPORT_METHOD(capture:(NSDictionary *)options callback:(RCTResponseSenderBlo
[self.bridge.eventDispatcher sendDeviceEventWithName:@"CameraBarCodeRead"
body:@{
@"type": metadata.type,
@"data": metadata.stringValue,
@"bounds": @{
@"origin": @{