Skip to content
This repository has been archived by the owner on Jun 16, 2023. It is now read-only.

Commit

Permalink
fix(barcode-prop): fix default value and add more values
Browse files Browse the repository at this point in the history
  • Loading branch information
jgfidelis committed Apr 13, 2018
1 parent 087fe60 commit 2c87b44
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ public class BarcodeFormatUtils {
map.put(Barcode.UPC_E, "UPC_E");
map.put(Barcode.PDF417, "PDF417");
map.put(Barcode.AZTEC, "AZTEC");
map.put(Barcode.ALL_FORMATS, "ALL");
map.put(Barcode.CALENDAR_EVENT, "CALENDAR_EVENT");
map.put(Barcode.CONTACT_INFO, "CONTACT_INFO");
map.put(Barcode.DRIVER_LICENSE, "DRIVER_LICENSE");
map.put(Barcode.EMAIL, "EMAIL");
map.put(Barcode.GEO, "GEO");
map.put(Barcode.ISBN, "ISBN");
map.put(Barcode.PHONE, "PHONE");
map.put(Barcode.PRODUCT, "PRODUCT");
map.put(Barcode.SMS, "SMS");
map.put(Barcode.TEXT, "TEXT");
map.put(Barcode.UPC_A, "UPC_A");
map.put(Barcode.URL, "URL");
map.put(Barcode.WIFI, "WIFI");
map.put(-1, "None");
FORMATS = map;


Expand All @@ -40,7 +55,6 @@ public class BarcodeFormatUtils {
rmap.put(map.valueAt(i), map.keyAt(i));
}

rmap.put("ALL", 0);
REVERSE_FORMATS = Collections.unmodifiableMap(rmap);
}

Expand Down
12 changes: 7 additions & 5 deletions src/RNCamera.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type EventCallbackArgumentsType = {
nativeEvent: Object,
};

type PropsType = (typeof View.props) & {
type PropsType = typeof View.props & {
zoom?: number,
ratio?: string,
focusDepth?: number,
Expand Down Expand Up @@ -87,7 +87,6 @@ type StateType = {
isAuthorizationChecked: boolean,
};


const CameraManager: Object = NativeModules.RNCameraManager ||
NativeModules.RNCameraModule || {
stubbed: true,
Expand All @@ -114,7 +113,7 @@ const CameraManager: Object = NativeModules.RNCameraManager ||
},
GoogleVisionBarcodeDetection: {
BarcodeType: 0,
}
},
};

const EventThrottleMs = 500;
Expand Down Expand Up @@ -183,7 +182,8 @@ export default class Camera extends React.Component<PropsType, StateType> {
whiteBalance: CameraManager.WhiteBalance.auto,
faceDetectionMode: (CameraManager.FaceDetection || {}).fast,
barCodeTypes: Object.values(CameraManager.BarCodeType),
googleVisionBarcodeType: (CameraManager.GoogleVisionBarcodeDetection || {}).BarcodeType,
googleVisionBarcodeType: ((CameraManager.GoogleVisionBarcodeDetection || {}).BarcodeType || {})
.None,
faceDetectionLandmarks: ((CameraManager.FaceDetection || {}).Landmarks || {}).none,
faceDetectionClassifications: ((CameraManager.FaceDetection || {}).Classifications || {}).none,
permissionDialogTitle: '',
Expand Down Expand Up @@ -330,7 +330,9 @@ export default class Camera extends React.Component<PropsType, StateType> {
ref={this._setReference}
onMountError={this._onMountError}
onCameraReady={this._onCameraReady}
onGoogleVisionBarcodesDetected={this._onObjectDetected(this.props.onGoogleVisionBarcodesDetected)}
onGoogleVisionBarcodesDetected={this._onObjectDetected(
this.props.onGoogleVisionBarcodesDetected,
)}
onBarCodeRead={this._onObjectDetected(this.props.onBarCodeRead)}
onFacesDetected={this._onObjectDetected(this.props.onFacesDetected)}
onTextRecognized={this._onObjectDetected(this.props.onTextRecognized)}
Expand Down

0 comments on commit 2c87b44

Please sign in to comment.