React Native · APIs and utilities
Permissions
Permission status, requesting and settings.
4 exports
Import
Permissions
modulePermission status, requesting and settings.
| Name | Type | Description |
|---|---|---|
check | (name: PermissionName) => Promise<PermissionStatus> | Returns the status; shows no dialog. |
checkMany | <N extends PermissionName>(names: readonly N[]) => Promise<Record<N, PermissionStatus>> | Status of several permissions. |
request | (name: PermissionName) => Promise<PermissionStatus> | Requests the permission. If it is granted, limited, blocked or unavailable, the status is returned without showing a dialog. |
requestMany | <N extends PermissionName>(names: readonly N[]) => Promise<Record<N, PermissionStatus>> | Requests several permissions in order. |
openSettings | () => Promise<void> | Opens the app's system settings page (for blocked permissions). |
isUsable | (status: PermissionStatus | undefined) => boolean | granted or limited: can work with the permission. |
usePermission
functionWatches a permission's status. The status is re-read when the app comes to the foreground (e.g. when the user returns from settings).
PermissionStatus
typePermission status.
granted: granted.limited: partially granted (selected photos, approximate location, provisional notifications).undetermined: not asked yet;requestshows a dialog.denied: denied but can be asked again (Android).blocked: cannot be asked again; can only be enabled in settings viaopenSettings.unavailable: not on the device or not defined in the app (ui.configpermissions).
UsePermissionResult
interfaceResult of usePermission.
| Name | Type | Description |
|---|---|---|
status | PermissionStatus | undefined | The last known status; undefined before the first check. |
request | () => Promise<PermissionStatus> | Requests the permission; returns the new status. |
check | () => Promise<PermissionStatus> | Reads the status again. |
openSettings | () => Promise<void> | Opens the app settings. |