From bbce1ca770cf15c790e10bc518e0895b951e1318 Mon Sep 17 00:00:00 2001 From: Lochlan Wansbrough Date: Sun, 3 May 2015 18:32:32 -0700 Subject: [PATCH] Fixes #24 --- RCTCamera.m | 17 +++++++++++++++-- package.json | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/RCTCamera.m b/RCTCamera.m index dd15b21..ed861ff 100644 --- a/RCTCamera.m +++ b/RCTCamera.m @@ -8,9 +8,22 @@ @implementation RCTCamera -- (void)setAspect:(NSString *)aspect +- (void)setAspect:(NSInteger)aspect { - [self.manager changeAspect:aspect]; + NSString *aspectString; + switch (aspect) { + default: + case RCTCameraAspectFill: + aspectString = AVLayerVideoGravityResizeAspectFill; + break; + case RCTCameraAspectFit: + aspectString = AVLayerVideoGravityResizeAspect; + break; + case RCTCameraAspectStretch: + aspectString = AVLayerVideoGravityResize; + break; + } + [self.manager changeAspect:aspectString]; } - (void)setType:(NSInteger)type diff --git a/package.json b/package.json index f04c051..08038f0 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "type" : "git", "url" : "https://github.com/lwansbrough/react-native-camera.git" }, - "version": "0.2.1", + "version": "0.2.2", "description": "A Camera component for React Native. Also reads barcodes.", "main": "Camera.ios.js", "author": "Lochlan Wansbrough (http://lwansbrough.com)",