From 09f18f1c5afe12a40f277e0c828a32ef8270b1ba Mon Sep 17 00:00:00 2001 From: Alex Merrifield Date: Fri, 19 Jan 2018 17:20:03 -0500 Subject: [PATCH] setup viewport size before using. --- ios/RCTCameraManager.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ios/RCTCameraManager.m b/ios/RCTCameraManager.m index 368e0f5..e791138 100644 --- a/ios/RCTCameraManager.m +++ b/ios/RCTCameraManager.m @@ -633,6 +633,9 @@ RCT_EXPORT_METHOD(hasFlash:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRej // create cgimage CGImageRef cgImage = CGImageSourceCreateImageAtIndex(source, 0, NULL); + // setup viewport size before using + CGSize viewportSize; + // Rotate it CGImageRef rotatedCGImage; if ([options objectForKey:@"rotation"]) { @@ -664,7 +667,6 @@ RCT_EXPORT_METHOD(hasFlash:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRej // Crop it if (self.cropToPreview) { - CGSize viewportSize; if (UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation])) {