This commit is contained in:
Lochlan Wansbrough 2015-07-20 16:49:41 -07:00
parent b3d6be156e
commit b1daed1e61
2 changed files with 10 additions and 2 deletions

View File

@ -213,7 +213,13 @@ RCT_EXPORT_METHOD(stopCapture) {
}
}
- (BOOL)isSimulator {
return [[[UIDevice currentDevice].model lowercaseString] rangeOfString:@"simulator"].location != NSNotFound;
}
- (void)startSession {
if ([self isSimulator]) return;
dispatch_async(self.sessionQueue, ^{
if (self.presetCamera == AVCaptureDevicePositionUnspecified) {
self.presetCamera = AVCaptureDevicePositionBack;
@ -256,6 +262,8 @@ RCT_EXPORT_METHOD(stopCapture) {
}
- (void)stopSession {
if ([self isSimulator]) return;
dispatch_async(self.sessionQueue, ^{
[self.previewLayer removeFromSuperlayer];
[self.session stopRunning];
@ -321,7 +329,7 @@ RCT_EXPORT_METHOD(stopCapture) {
- (void)captureStill:(NSInteger)target options:(NSDictionary *)options callback:(RCTResponseSenderBlock)callback {
dispatch_async(self.sessionQueue, ^{
if ([[[UIDevice currentDevice].model lowercaseString] rangeOfString:@"simulator"].location != NSNotFound){
if ([self isSimulator]){
CGSize size = CGSizeMake(720, 1280);
UIGraphicsBeginImageContextWithOptions(size, YES, 0);

View File

@ -4,7 +4,7 @@
"type" : "git",
"url" : "https://github.com/lwansbrough/react-native-camera.git"
},
"version": "0.3.2",
"version": "0.3.3",
"description": "A Camera component for React Native. Also reads barcodes.",
"main": "Camera.ios.js",
"author": "Lochlan Wansbrough <lochie@live.com> (http://lwansbrough.com)",