Kaynağa Gözat

fix default location permission. Make sure you always return a promise from checkMultiplePermissions

Yonah Forst 8 yıl önce
ebeveyn
işleme
477c991d16
1 değiştirilmiş dosya ile 3 ekleme ve 3 silme
  1. 3
    3
      ReactNativePermissions.js

+ 3
- 3
ReactNativePermissions.js Dosyayı Görüntüle

@@ -71,9 +71,9 @@ class ReactNativePermissions {
71 71
 		if (!this.getPermissionTypes().includes(permission)) {
72 72
 			return Promise.reject(`ReactNativePermissions: ${permission} is not a valid permission type on ${Platform.OS}`)
73 73
 		} else if (permission == 'backgroundRefresh'){
74
-			return Promise.reject('You cannot request backgroundRefresh')
74
+			return Promise.reject('ReactNativePermissions: You cannot request backgroundRefresh')
75 75
 		} else if (permission == 'location') {
76
-			options = type || 'always'
76
+			options = type || 'whenInUse'
77 77
 		} else if (permission == 'notification') {
78 78
 			options = type || ['alert', 'badge', 'sound']
79 79
 		}
@@ -91,7 +91,7 @@ class ReactNativePermissions {
91 91
 			let p = permissions[i]
92 92
 			
93 93
 			if (!p) {
94
-				return obj
94
+				return Promise.resolve(obj)
95 95
 			}
96 96
 
97 97
 			return that.getPermissionStatus(p)