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,
|
||||
});
|
||||
|
||||
// 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({
|
||||
isAuthorized: granted === PermissionsAndroid.RESULTS.GRANTED,
|
||||
isAuthorizationChecked: true,
|
||||
isAuthorized,
|
||||
isAuthorizationChecked: true
|
||||
});
|
||||
|
||||
} else {
|
||||
this.setState({ isAuthorized: true, isAuthorizationChecked: true });
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user