mirror of
https://github.com/status-im/react-native-camera.git
synced 2026-08-27 11:41:09 +00:00
skip permissions request
This commit is contained in:
+4
-10
@@ -183,8 +183,8 @@ export default class Camera extends React.Component<PropsType> {
|
||||
this._lastEvents = {};
|
||||
this._lastEventsTimes = {};
|
||||
this.state = {
|
||||
isAuthorized: false,
|
||||
isAuthorizationChecked: false,
|
||||
isAuthorized: true,
|
||||
isAuthorizationChecked: true,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -262,14 +262,13 @@ export default class Camera extends React.Component<PropsType> {
|
||||
|
||||
async componentWillMount() {
|
||||
const hasVideoAndAudio = this.props.captureAudio;
|
||||
const isAuthorized = await requestPermissions(hasVideoAndAudio, CameraManager, this.props.permissionDialogTitle, this.props.permissionDialogMessage);
|
||||
this.setState({ isAuthorized, isAuthorizationChecked: true });
|
||||
//const isAuthorized = await requestPermissions(hasVideoAndAudio, CameraManager, this.props.permissionDialogTitle, this.props.permissionDialogMessage);
|
||||
//this.setState({ isAuthorized, isAuthorizationChecked: true });
|
||||
}
|
||||
|
||||
render() {
|
||||
const nativeProps = this._convertNativeProps(this.props);
|
||||
|
||||
if (this.state.isAuthorized) {
|
||||
return (
|
||||
<RNCamera
|
||||
{...nativeProps}
|
||||
@@ -280,11 +279,6 @@ export default class Camera extends React.Component<PropsType> {
|
||||
onFacesDetected={this._onObjectDetected(this.props.onFacesDetected)}
|
||||
/>
|
||||
);
|
||||
} else if (!this.state.isAuthorizationChecked) {
|
||||
return this.props.pendingAuthorizationView;
|
||||
} else {
|
||||
return this.props.notAuthorizedView;
|
||||
}
|
||||
}
|
||||
|
||||
_convertNativeProps(props: PropsType) {
|
||||
|
||||
Reference in New Issue
Block a user