0.3.8 • Published 4 months ago
rn-smart-permissions v0.3.8
rn-smart-permissions
Permissions Library for React Native ( Android and iOS). The NPM package is https://www.npmjs.com/package/rn-smart-permissions
Installation
npm install rn-smart-permissions
Advantages
Usage
import { checkAndRequestPermissions, PERMISSION, PERMISSION_RESULT} from 'rn-smart-permissions';
// ...
checkAndRequestPermissions(
PERMISSION.LOCATION,
() => {
//Rationale dialog here
return new Promise((resolve) => {
//show rationale dialog here and resolve the promise with true to continue
});
},
() => {
//blocked permission dialog here
return new Promise((resolve) => {
//show blocked permission dialog here and resolve the promise with true to open settings
});
}
)
.then((result) => {
if (result === PERMISSION_RESULT.AUTHORIZED) {
Alert.alert('', 'Got All access');
}
})
.catch((e) => {
console.log('permission', e);
});
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
Thanks
- https://www.npmjs.com/package/react-native-permissions
- https://www.npmjs.com/package/react-native-android-location-enabler
License
MIT
Made with create-react-native-library