react-native-permissions
Advanced tools
Comparing version 1.0.3 to 1.0.4
// @flow | ||
import { Platform } from 'react-native' | ||
export default (Platform.OS === 'ios' | ||
? require('./index.ios') | ||
: require('./index.android')) | ||
import Permissions from './lib/permissions' | ||
export { Permissions as default } |
{ | ||
"name": "react-native-permissions", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Check user permissions in React Native", | ||
@@ -22,2 +22,3 @@ "author": "Yonah Forst <yonaforst@hotmail.com>", | ||
"devDependencies": { | ||
"flow-bin": "^0.57.3", | ||
"husky": "^0.14.3", | ||
@@ -24,0 +25,0 @@ "lint-staged": "^5.0.0", |
@@ -13,3 +13,3 @@ # ☝🏼 React Native Permissions | ||
| ------- | -------------------- | | ||
| 1.0.3 | 0.40 - 0.50 | | ||
| 1.0.4 | 0.40 - 0.50 | | ||
| 0.2.5 | 0.33 - 0.39 | | ||
@@ -191,13 +191,15 @@ | ||
// example | ||
Permissions.check('location', 'always').then(response => { | ||
Permissions.check('location', { type: 'always' }).then(response => { | ||
this.setState({ locationPermission: response }) | ||
}) | ||
Permissions.request('location', 'always').then(response => { | ||
Permissions.request('location', { type: 'always' }).then(response => { | ||
this.setState({ locationPermission: response }) | ||
}) | ||
Permissions.request('notification', ['alert', 'badge']).then(response => { | ||
this.setState({ notificationPermission: response }) | ||
}) | ||
Permissions.request('notification', { type: ['alert', 'badge'] }).then( | ||
response => { | ||
this.setState({ notificationPermission: response }) | ||
}, | ||
) | ||
``` | ||
@@ -259,2 +261,19 @@ | ||
[here](https://developer.android.com/guide/topics/security/permissions.html#normal-dangerous). | ||
* The optional rationale argument will show a dialog prompt. | ||
```js | ||
// example | ||
Permissions.request('camera', { | ||
rationale: { | ||
title: 'Cool Photo App Camera Permission', | ||
message: | ||
'Cool Photo App needs access to your camera ' + | ||
'so you can take awesome pictures.', | ||
}, | ||
}).then(response => { | ||
this.setState({ cameraPermission: response }) | ||
}) | ||
``` | ||
* Permissions are automatically accepted for **targetSdkVersion < 23** but you | ||
@@ -261,0 +280,0 @@ can still use `check()` to check if the user has disabled them from Settings. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
92652
37
175
305
1
4