Skip to content

Commit df3addd

Browse files
committed
Return no supported permissions for platforms other than iOS / android
1 parent 54ac46f commit df3addd

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/index.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,11 @@ if (RNPermissions == null) {
129129
If none of these fix the issue, please open an issue on the Github repository: https://github.com/react-native-community/react-native-permissions`);
130130
}
131131

132-
const platformPermissions = Object.values(
133-
Platform.OS === 'ios' ? IOS : ANDROID,
134-
);
132+
const platformPermissions = Platform.select<Permission[]>({
133+
ios: Object.values(IOS),
134+
android: Object.values(ANDROID),
135+
default: [],
136+
});
135137

136138
function isPlatformPermission(permission: Permission): boolean {
137139
if (platformPermissions.includes(permission)) {
@@ -158,7 +160,7 @@ export async function check(permission: Permission): Promise<PermissionStatus> {
158160
return RESULTS.UNAVAILABLE;
159161
}
160162

161-
if (Platform.OS !== 'android') {
163+
if (Platform.OS === 'ios') {
162164
return RNPermissions.check(permission);
163165
}
164166

@@ -194,7 +196,7 @@ export async function request(
194196
return RESULTS.UNAVAILABLE;
195197
}
196198

197-
if (Platform.OS !== 'android') {
199+
if (Platform.OS === 'ios') {
198200
return RNPermissions.request(permission);
199201
}
200202

0 commit comments

Comments
 (0)