Skip to content

Commit b1daed1

Browse files
committed
1 parent b3d6be1 commit b1daed1

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

RCTCameraManager.m

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,13 @@ - (id)init {
213213
}
214214
}
215215

216+
- (BOOL)isSimulator {
217+
return [[[UIDevice currentDevice].model lowercaseString] rangeOfString:@"simulator"].location != NSNotFound;
218+
}
219+
216220
- (void)startSession {
221+
if ([self isSimulator]) return;
222+
217223
dispatch_async(self.sessionQueue, ^{
218224
if (self.presetCamera == AVCaptureDevicePositionUnspecified) {
219225
self.presetCamera = AVCaptureDevicePositionBack;
@@ -256,6 +262,8 @@ - (void)startSession {
256262
}
257263

258264
- (void)stopSession {
265+
if ([self isSimulator]) return;
266+
259267
dispatch_async(self.sessionQueue, ^{
260268
[self.previewLayer removeFromSuperlayer];
261269
[self.session stopRunning];
@@ -321,7 +329,7 @@ - (void)initializeCaptureSessionInput:(NSString *)type {
321329

322330
- (void)captureStill:(NSInteger)target options:(NSDictionary *)options callback:(RCTResponseSenderBlock)callback {
323331
dispatch_async(self.sessionQueue, ^{
324-
if ([[[UIDevice currentDevice].model lowercaseString] rangeOfString:@"simulator"].location != NSNotFound){
332+
if ([self isSimulator]){
325333

326334
CGSize size = CGSizeMake(720, 1280);
327335
UIGraphicsBeginImageContextWithOptions(size, YES, 0);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type" : "git",
55
"url" : "https://github.com/lwansbrough/react-native-camera.git"
66
},
7-
"version": "0.3.2",
7+
"version": "0.3.3",
88
"description": "A Camera component for React Native. Also reads barcodes.",
99
"main": "Camera.ios.js",
1010
"author": "Lochlan Wansbrough <[email protected]> (http://lwansbrough.com)",

0 commit comments

Comments
 (0)