react-native-authorization
Request user permissions from React Native, iOS + Android
- iOS: need add authorization’s key in info.plist
- android: need add permission in AndroidManifest.xml
Content
Installation
# step 1
npm install react-native-authorization
# yarn add react-native-authorization
# step 2
react-native link react-native-authorization
Usage
import Helper from 'react-native-authorization'
Helper.check(Helper.CAMERA).then((r)=>{
console.log(r);
});
API
Methods
Method Name | Arguments | Notes | iOS | android |
---|---|---|---|---|
check | type | Returns a promise | ||
multipleCheck | [type1,type2] | Returns a promise |
Check Type
Name | iOS | android |
---|---|---|
CAMERA | ||
LIBRARY | ||
LOCATION | ||
ALWAYSLOCATION | ||
USELOCATION | ||
MIKE | ||
CALENDAR | ||
CONTACTS | ||
MICROPHONE | ||
PHONE | ||
SENSORS | ||
SMS | ||
STORAGE |
Permission Result
Result | Type | iOS | android |
---|---|---|---|
Authorized |
string | ||
AuthorizedAlways |
string | ||
AuthorizedWhenInUse |
string | ||
Denied |
string | ||
NotDetermined |
string | ||
Restricted |
string | ||
true |
boolean | ||
false |
boolean |
Author
Ruwei Li, liruwei0109@outlook.com
License
react-native-authorization is available under the ISC license. See the LICENSE file for more info.