Ver código fonte

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 anos atrás
pai
commit
0ecbb90bf5
1 arquivos alterados com 3 adições e 0 exclusões
  1. 3
    0
      index.android.js

+ 3
- 0
index.android.js Ver arquivo

@@ -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
 			});