From 1b79493221c0170e5b7a81147117c9fc1b711722 Mon Sep 17 00:00:00 2001 From: PJ Cabrera Date: Wed, 2 Dec 2015 11:39:02 -0800 Subject: [PATCH] Fix for back camera showing briefly when the type property is set to 'front'. The first time an app is run that uses this component with the type set to 'front', the back camera shows briefly before the component obeys the type property and switches to the front camera. The presetCamera should be set to the proper camera type set in the props when the component is created. --- ios/RCTCameraManager.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ios/RCTCameraManager.m b/ios/RCTCameraManager.m index eb2e733..dc8355d 100644 --- a/ios/RCTCameraManager.m +++ b/ios/RCTCameraManager.m @@ -14,6 +14,12 @@ RCT_EXPORT_MODULE(); +- (UIView *)viewWithProps:(__unused NSDictionary *)props +{ + self.presetCamera = ((NSNumber *)props[@"type"]).integerValue; + return [self view]; +} + - (UIView *)view { return [[RCTCamera alloc] initWithManager:self bridge:self.bridge];