Browse Source

Fix modules

Mathieu Acthernoene 8 years ago
parent
commit
1a3c1a9ef1
2 changed files with 13 additions and 9 deletions
  1. 1 1
      index.android.js
  2. 12 8
      index.ios.js

+ 1 - 1
index.android.js

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

+ 12 - 8
index.ios.js

@@ -36,7 +36,10 @@ class ReactNativePermissions {
       )
     }
 
-    return PermissionsIOS.getPermissionStatus(permission, type)
+    return PermissionsIOS.getPermissionStatus(
+      permission,
+      type || DEFAULTS[permission],
+    )
   }
 
   request = (permission, type) => {
@@ -61,13 +64,14 @@ class ReactNativePermissions {
   }
 
   checkMultiple = permissions =>
-    Promise.all(permissions.map(this.check)).then(result =>
-      result.reduce((acc, value, index) => {
-        const name = permissions[index]
-        acc[name] = value
-        return acc
-      }, {}),
+    Promise.all(permissions.map(permission => this.check(permission))).then(
+      result =>
+        result.reduce((acc, value, index) => {
+          const name = permissions[index]
+          acc[name] = value
+          return acc
+        }, {}),
     )
 }
 
-export default new ReactNativePermissions()
+module.exports = new ReactNativePermissions()