Mathieu Acthernoene преди 7 години
родител
ревизия
1a3c1a9ef1
променени са 2 файла, в които са добавени 13 реда и са изтрити 9 реда
  1. 1
    1
      index.android.js
  2. 12
    8
      index.ios.js

+ 1
- 1
index.android.js Целия файл

@@ -93,4 +93,4 @@ class ReactNativePermissions {
93 93
     )
94 94
 }
95 95
 
96
-export default new ReactNativePermissions()
96
+module.exports = new ReactNativePermissions()

+ 12
- 8
index.ios.js Целия файл

@@ -36,7 +36,10 @@ class ReactNativePermissions {
36 36
       )
37 37
     }
38 38
 
39
-    return PermissionsIOS.getPermissionStatus(permission, type)
39
+    return PermissionsIOS.getPermissionStatus(
40
+      permission,
41
+      type || DEFAULTS[permission],
42
+    )
40 43
   }
41 44
 
42 45
   request = (permission, type) => {
@@ -61,13 +64,14 @@ class ReactNativePermissions {
61 64
   }
62 65
 
63 66
   checkMultiple = permissions =>
64
-    Promise.all(permissions.map(this.check)).then(result =>
65
-      result.reduce((acc, value, index) => {
66
-        const name = permissions[index]
67
-        acc[name] = value
68
-        return acc
69
-      }, {}),
67
+    Promise.all(permissions.map(permission => this.check(permission))).then(
68
+      result =>
69
+        result.reduce((acc, value, index) => {
70
+          const name = permissions[index]
71
+          acc[name] = value
72
+          return acc
73
+        }, {}),
70 74
     )
71 75
 }
72 76
 
73
-export default new ReactNativePermissions()
77
+module.exports = new ReactNativePermissions()