diff --git a/ios/RCTCameraManager.m b/ios/RCTCameraManager.m index 74ff087..f51aa33 100644 --- a/ios/RCTCameraManager.m +++ b/ios/RCTCameraManager.m @@ -712,18 +712,20 @@ didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL for (AVMetadataMachineReadableCodeObject *metadata in metadataObjects) { for (id barcodeType in [self getBarCodeTypes]) { if (metadata.type == barcodeType) { + // Transform the meta-data coordinates to screen coords + AVMetadataMachineReadableCodeObject *transformed = (AVMetadataMachineReadableCodeObject *)[_previewLayer transformedMetadataObjectForMetadataObject:metadata]; NSDictionary *event = @{ @"type": metadata.type, @"data": metadata.stringValue, @"bounds": @{ @"origin": @{ - @"x": [NSString stringWithFormat:@"%f", metadata.bounds.origin.x], - @"y": [NSString stringWithFormat:@"%f", metadata.bounds.origin.y] + @"x": [NSString stringWithFormat:@"%f", transformed.bounds.origin.x], + @"y": [NSString stringWithFormat:@"%f", transformed.bounds.origin.y] }, @"size": @{ - @"height": [NSString stringWithFormat:@"%f", metadata.bounds.size.height], - @"width": [NSString stringWithFormat:@"%f", metadata.bounds.size.width], + @"height": [NSString stringWithFormat:@"%f", transformed.bounds.size.height], + @"width": [NSString stringWithFormat:@"%f", transformed.bounds.size.width], } } };