Przeglądaj źródła

Merge pull request #163 from convoyinc/v1.0.1

Fixed request logic for OS versions prior to Android M (6.0 that is)
Yonah Forst 7 lat temu
rodzic
commit
0ecbb90bf5
1 zmienionych plików z 3 dodań i 0 usunięć
  1. 3
    0
      index.android.js

+ 3
- 0
index.android.js Wyświetl plik

@@ -70,6 +70,9 @@ class ReactNativePermissions {
70 70
 
71 71
 		return RNPermissions.request(androidPermission)
72 72
 			.then(res => {
73
+				// RNPermissions.request() to native module resolves to boolean
74
+				// rather than string if running on OS version prior to Android M 
75
+				if (typeof res === 'boolean') return res ? 'authorized' : 'denied';
73 76
 				return setDidAskOnce(permission)
74 77
 					.then(() => RESULTS[res])
75 78
 			});