Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

expo-permissions

Package Overview
Dependencies
Maintainers
26
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expo-permissions - npm Package Compare versions

Comparing version 12.0.0 to 12.0.1

21

build/PermissionsHooks.js

@@ -1,2 +0,2 @@

import { useCallback, useEffect, useState } from 'react';
import { useCallback, useRef, useEffect, useState } from 'react';
import { askAsync, getAsync } from './Permissions';

@@ -20,2 +20,3 @@ /**

export function usePermissions(type, options = {}) {
const isMounted = useRef(true);
const [data, setData] = useState();

@@ -27,4 +28,12 @@ const { ask = false, get = true } = options;

// to prevent unnecessary function instances we need to listen to the "raw" value.
const askPermissions = useCallback(() => askAsync(...types).then(setData), [type]);
const getPermissions = useCallback(() => getAsync(...types).then(setData), [type]);
const askPermissions = useCallback(() => askAsync(...types).then(response => {
if (isMounted.current) {
setData(response);
}
}), [type]);
const getPermissions = useCallback(() => getAsync(...types).then(response => {
if (isMounted.current) {
setData(response);
}
}), [type]);
useEffect(() => {

@@ -38,4 +47,10 @@ if (ask) {

}, [ask, askPermissions, get, getPermissions]);
useEffect(() => {
isMounted.current = true;
return () => {
isMounted.current = false;
};
}, []);
return [data, askPermissions, getPermissions];
}
//# sourceMappingURL=PermissionsHooks.js.map

@@ -11,2 +11,8 @@ # Changelog

## 12.0.1 — 2021-04-13
### 🐛 Bug fixes
- Guard updating hook state on unmounted components. ([#12482](https://github.com/expo/expo/pull/12482) by [@EvanBacon](https://github.com/EvanBacon))
## 12.0.0 — 2021-03-10

@@ -13,0 +19,0 @@

4

package.json
{
"name": "expo-permissions",
"version": "12.0.0",
"version": "12.0.1",
"description": "Allows you prompt for various permissions to access device sensors, personal data, etc.",

@@ -40,3 +40,3 @@ "main": "build/index.js",

},
"gitHead": "5b57d1fd0a20294c1dec7c43b5df34dd6425d1a5"
"gitHead": "9c6693e1e8997dd279d408b0f6e6490897713085"
}

@@ -1,2 +0,2 @@

import { useCallback, useEffect, useState } from 'react';
import { useCallback, useRef, useEffect, useState } from 'react';

@@ -26,2 +26,3 @@ import { askAsync, getAsync } from './Permissions';

): [PermissionResponse | undefined, () => Promise<void>, () => Promise<void>] {
const isMounted = useRef(true);
const [data, setData] = useState<PermissionResponse>();

@@ -35,5 +36,21 @@ const { ask = false, get = true } = options;

const askPermissions = useCallback(() => askAsync(...types).then(setData), [type]);
const askPermissions = useCallback(
() =>
askAsync(...types).then(response => {
if (isMounted.current) {
setData(response);
}
}),
[type]
);
const getPermissions = useCallback(() => getAsync(...types).then(setData), [type]);
const getPermissions = useCallback(
() =>
getAsync(...types).then(response => {
if (isMounted.current) {
setData(response);
}
}),
[type]
);

@@ -50,2 +67,9 @@ useEffect(() => {

useEffect(() => {
isMounted.current = true;
return () => {
isMounted.current = false;
};
}, []);
return [data, askPermissions, getPermissions];

@@ -52,0 +76,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc