fix(barcode-prop): fix default value and add more values

This commit is contained in:
Joao Fidelis 2018-04-13 13:17:05 -03:00
parent 087fe6098a
commit 2c87b44b16
2 changed files with 22 additions and 6 deletions

View File

@ -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;
@ -40,7 +55,6 @@ public class BarcodeFormatUtils {
rmap.put(map.valueAt(i), map.keyAt(i));
}
rmap.put("ALL", 0);
REVERSE_FORMATS = Collections.unmodifiableMap(rmap);
}

View File

@ -59,7 +59,7 @@ type EventCallbackArgumentsType = {
nativeEvent: Object,
};
type PropsType = (typeof View.props) & {
type PropsType = typeof View.props & {
zoom?: number,
ratio?: string,
focusDepth?: number,
@ -87,7 +87,6 @@ type StateType = {
isAuthorizationChecked: boolean,
};
const CameraManager: Object = NativeModules.RNCameraManager ||
NativeModules.RNCameraModule || {
stubbed: true,
@ -114,7 +113,7 @@ const CameraManager: Object = NativeModules.RNCameraManager ||
},
GoogleVisionBarcodeDetection: {
BarcodeType: 0,
}
},
};
const EventThrottleMs = 500;
@ -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: '',
@ -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)}