mirror of
https://github.com/status-im/react-native-camera.git
synced 2025-02-24 09:48:17 +00:00
Merge pull request #1095 from punksta/patch-1
fix camera permission handle in android below 6.0
This commit is contained in:
commit
be0f94ceed
@ -191,10 +191,18 @@ export default class Camera extends Component {
|
|||||||
message: this.props.permissionDialogMessage,
|
message: this.props.permissionDialogMessage,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// On devices before SDK version 23, the permissions are automatically granted if they appear in the manifest,
|
||||||
|
// so check and request should always be true.
|
||||||
|
// https://github.com/facebook/react-native-website/blob/master/docs/permissionsandroid.md
|
||||||
|
const isAuthorized = Platform.Version >= 23
|
||||||
|
? granted === PermissionsAndroid.RESULTS.GRANTED
|
||||||
|
: granted === true;
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
isAuthorized: granted === PermissionsAndroid.RESULTS.GRANTED,
|
isAuthorized,
|
||||||
isAuthorizationChecked: true,
|
isAuthorizationChecked: true
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.setState({ isAuthorized: true, isAuthorizationChecked: true });
|
this.setState({ isAuthorized: true, isAuthorizationChecked: true });
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user