mirror of
https://github.com/status-im/react-native-camera.git
synced 2025-02-24 17:58:20 +00:00
[captureMode] conver string captureMode prop, only check audio permission if in video mode
This commit is contained in:
parent
0c789b8da0
commit
921965208f
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user