Fixes #71
This commit is contained in:
parent
b3d6be156e
commit
b1daed1e61
|
@ -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);
|
||||
|
|
|
@ -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)",
|
||||
|
|
Loading…
Reference in New Issue