From 921965208f1560890ef47b27e8e265c026885406 Mon Sep 17 00:00:00 2001 From: Zack Story Date: Sun, 3 Apr 2016 12:29:58 -0700 Subject: [PATCH] [captureMode] conver string captureMode prop, only check audio permission if in video mode --- Camera.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Camera.js b/Camera.js index 61dd09b..1256790 100644 --- a/Camera.js +++ b/Camera.js @@ -38,6 +38,10 @@ function convertStringProps(props) { newProps.captureQuality = Camera.constants.CaptureQuality[props.captureQuality]; } + if (typeof props.captureMode === 'string') { + newProps.captureMode = Camera.constants.CaptureMode[props.captureMode]; + } + return newProps; } @@ -133,7 +137,9 @@ export default class Camera extends Component { async componentWillMount() { this.cameraBarCodeReadListener = NativeAppEventEmitter.addListener('CameraBarCodeRead', this.props.onBarCodeRead); - let check = this.props.captureAudio ? Camera.checkDeviceAuthorizationStatus : Camera.checkVideoAuthorizationStatus; + let { captureMode } = convertStringProps({captureMode: this.props.captureMode}) + let hasVideoAndAudio = this.props.captureAudio && captureMode === Camera.constants.CaptureMode.video + let check = hasVideoAndAudio ? Camera.checkDeviceAuthorizationStatus : Camera.checkVideoAuthorizationStatus; if (check) { const isAuthorized = await check();