Skip to content

Instantly share code, notes, and snippets.

@ShanikaNishadhi
Created November 19, 2020 22:12
Show Gist options
  • Save ShanikaNishadhi/4cbb1e9dfbe593893ef003a4d034eda8 to your computer and use it in GitHub Desktop.
Save ShanikaNishadhi/4cbb1e9dfbe593893ef003a4d034eda8 to your computer and use it in GitHub Desktop.
import {check, PERMISSIONS, RESULTS} from 'react-native-permissions';
check(PERMISSIONS.IOS.CAMERA)
.then((result) => {
switch (result) {
case RESULTS.UNAVAILABLE:
console.log(
'feature is not available',
);
break;
case RESULTS.DENIED:
console.log('permission has not been requested / is denied but requestable',);
break;
case RESULTS.GRANTED:
console.log('The permission is granted');
break;
case RESULTS.BLOCKED:
console.log('The permission is denied and not requestable anymore');
break;
}
})
.catch((error) => {
// …
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment