Browse Source

fix checkMultiple handling of permissions with type on iOS

erezrokah 7 years ago
parent
commit
f2f387bc8a
1 changed files with 3 additions and 1 deletions
  1. 3
    1
      index.ios.js

+ 3
- 1
index.ios.js View File

39
   	if (!RNPTypes.includes(permission)) {
39
   	if (!RNPTypes.includes(permission)) {
40
 			return Promise.reject(`ReactNativePermissions: ${permission} is not a valid permission type on iOS`);
40
 			return Promise.reject(`ReactNativePermissions: ${permission} is not a valid permission type on iOS`);
41
 		}
41
 		}
42
+				
43
+		type = type || DEFAULTS[permission]
42
 		
44
 		
43
 		return RNPermissions.getPermissionStatus(permission, type);
45
 		return RNPermissions.getPermissionStatus(permission, type);
44
 	}
46
 	}
58
 	}
60
 	}
59
 
61
 
60
 	checkMultiple(permissions) {
62
 	checkMultiple(permissions) {
61
-		return Promise.all(permissions.map(this.check.bind(this)))
63
+		return Promise.all(permissions.map(permission => this.check(permission)))
62
 			.then(res => res.reduce((pre, cur, i) => {
64
 			.then(res => res.reduce((pre, cur, i) => {
63
 				var name = permissions[i]
65
 				var name = permissions[i]
64
 				pre[name] = cur
66
 				pre[name] = cur