如何使用 react-native-camera 的 refreshAuthorizationStatus 函数
How to use refreshAuthorizationStatus function for react-native-camera
我想使用函数 refreshAuthorizationStatus,来自 here
而且我还希望在未授予权限时进行回调。谁能帮我这个?我还没有找到如何调用此函数的示例。我在我的本机反应项目中为我的相机设置了以下设置:
<RNCamera
ref={ref => {
this.camera = ref;
}}
orientation='portrait'
captureAudio={false}
type={RNCamera.Constants.Type.front}
flashMode={RNCamera.Constants.FlashMode.off}
androidCameraPermissionOptions={{
title: 'Permission to use camera',
message: 'We need your permission to use your camera',
buttonPositive: 'Ok',
buttonNegative: 'Cancel',
}}
androidRecordAudioPermissionOptions={{
title: 'Permission to use audio recording',
message: 'We need your permission to use your audio',
buttonPositive: 'Ok',
buttonNegative: 'Cancel',
}}
style={styles.camera}>
<TouchableOpacity onPress={this.takePicture.bind(this)}></TouchableOpacity>
</RNCamera>
通过以下方式授予的权限:
等待 this.camera.refreshAuthorizationStatus()
,this.camera
是一个引用集,
this.camera.refreshAuthorizationStatus().then(() => {
//
}).catch((e) =>{
//
}):
我想使用函数 refreshAuthorizationStatus,来自 here
而且我还希望在未授予权限时进行回调。谁能帮我这个?我还没有找到如何调用此函数的示例。我在我的本机反应项目中为我的相机设置了以下设置:
<RNCamera
ref={ref => {
this.camera = ref;
}}
orientation='portrait'
captureAudio={false}
type={RNCamera.Constants.Type.front}
flashMode={RNCamera.Constants.FlashMode.off}
androidCameraPermissionOptions={{
title: 'Permission to use camera',
message: 'We need your permission to use your camera',
buttonPositive: 'Ok',
buttonNegative: 'Cancel',
}}
androidRecordAudioPermissionOptions={{
title: 'Permission to use audio recording',
message: 'We need your permission to use your audio',
buttonPositive: 'Ok',
buttonNegative: 'Cancel',
}}
style={styles.camera}>
<TouchableOpacity onPress={this.takePicture.bind(this)}></TouchableOpacity>
</RNCamera>
通过以下方式授予的权限:
等待 this.camera.refreshAuthorizationStatus()
,this.camera
是一个引用集,
this.camera.refreshAuthorizationStatus().then(() => {
//
}).catch((e) =>{
//
}):