rebased
This commit is contained in:
parent
8d525cea05
commit
ce3fd49580
|
@ -35,7 +35,7 @@ export default class CameraScreen extends Component {
|
|||
laserColor={"blue"}
|
||||
frameColor={"yellow"}
|
||||
|
||||
onReadCode={((event) => Alert.alert(`Qr code found ${event.nativeEvent.qrcodeStringValue} `))}
|
||||
onReadCode={((event) => Alert.alert(`Qr code found ${event.nativeEvent.codeStringValue} `))}
|
||||
hideControls={true}
|
||||
isShowFrameForScanner={true}
|
||||
// offsetForScannerFrame = {10}
|
||||
|
|
|
@ -85,7 +85,7 @@ RCT_ENUM_CONVERTER(CKCameraZoomMode, (@{
|
|||
@property (nonatomic) AVCaptureMovieFileOutput *movieFileOutput;
|
||||
@property (nonatomic) AVCaptureStillImageOutput *stillImageOutput;
|
||||
@property (nonatomic, strong) AVCaptureMetadataOutput *metadataOutput;
|
||||
@property (nonatomic, strong) NSString *qrcodeStringValue;
|
||||
@property (nonatomic, strong) NSString *codeStringValue;
|
||||
|
||||
|
||||
// utilities
|
||||
|
@ -1050,9 +1050,9 @@ didOutputMetadataObjects:(NSArray<__kindof AVMetadataObject *> *)metadataObjects
|
|||
if ([metadataObject isKindOfClass:[AVMetadataMachineReadableCodeObject class]] && [self isSupportedBarCodeType:metadataObject.type]) {
|
||||
AVMetadataMachineReadableCodeObject *code = (AVMetadataMachineReadableCodeObject*)[self.previewLayer transformedMetadataObjectForMetadataObject:metadataObject];
|
||||
|
||||
if (self.onReadCode && code.stringValue && ![code.stringValue isEqualToString:self.qrcodeStringValue]) {
|
||||
self.qrcodeStringValue = code.stringValue;
|
||||
self.onReadCode(@{@"qrcodeStringValue": code.stringValue});
|
||||
if (self.onReadCode && code.stringValue && ![code.stringValue isEqualToString:self.codeStringValue]) {
|
||||
self.codeStringValue = code.stringValue;
|
||||
self.onReadCode(@{@"codeStringValue": code.stringValue});
|
||||
[self stopAnimatingScanner];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ const FLASH_MODE_AUTO = 'auto';
|
|||
const FLASH_MODE_ON = 'on';
|
||||
const FLASH_MODE_OFF = 'off';
|
||||
const OVERLAY_DEFAULT_COLOR = '#ffffff77';
|
||||
const OFFSET_FRAME = 30;
|
||||
const FRAME_HEIGHT = 200;
|
||||
|
||||
export default class CameraScreenBase extends Component {
|
||||
|
||||
|
@ -100,13 +102,13 @@ export default class CameraScreenBase extends Component {
|
|||
}
|
||||
|
||||
getScannerOptions() {
|
||||
const scannerOptions = this.props.scannerOptions || {}
|
||||
scannerOptions.offsetFrame = this.props.offsetForScannerFrame || 30
|
||||
scannerOptions.frameHeight = this.props.heightForScannerFrame || 200
|
||||
const scannerOptions = this.props.scannerOptions || {};
|
||||
scannerOptions.offsetFrame = this.props.offsetForScannerFrame || OFFSET_FRAME;
|
||||
scannerOptions.frameHeight = this.props.heightForScannerFrame || FRAME_HEIGHT;
|
||||
if (this.props.colorForScannerFrame) {
|
||||
scannerOptions.colorForFrame = processColor(this.props.colorForScannerFrame)
|
||||
scannerOptions.colorForFrame = processColor(this.props.colorForScannerFrame);
|
||||
} else {
|
||||
scannerOptions.colorForFrame = processColor("white")
|
||||
scannerOptions.colorForFrame = processColor("white");
|
||||
}
|
||||
return scannerOptions;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue