react-native-permissions provides a unified, cross-platform API for managing user permissions on iOS, Android, and Windows within React Native applications. It abstracts away the platform-specific nuances of checking and requesting permissions like camera, location, and notifications, offering a consistent interface. The current stable version is 5.5.1. The library follows the React Native release support policy, supporting the latest version and the two previous minor series, indicating a regular update cadence aligned with React Native itself. A key differentiator is its modular iOS setup, where developers explicitly enable only the permissions they need via a `Podfile` script, reducing the app's binary size and simplifying configuration, alongside robust TypeScript support and handling of nuances like Android's one-time permissions. It supports Windows builds 18362 and later, extending its reach beyond mobile.
npm install react-native-permissionsVerified import paths — ran on the pinned version, not inferred.
Demonstrates checking and requesting camera permission, handling different statuses across iOS and Android.
Ensure your `tsconfig.json` (for TypeScript projects) has `"moduleResolution": "bundler"` configured, or update your bundler settings if not using TypeScript, to correctly resolve module imports.
In your `Podfile`, use `node_require('react-native-permissions/scripts/setup.rb')` and call `setup_permissions([])` with the desired permissions. Then, add privacy keys (e.g., `NSCameraUsageDescription`) to your `Info.plist` with a user-facing reason string.Upgrade to `react-native-permissions` v5.4.2 or higher to ensure `check` returns `DENIED` when appropriate for unsupported permissions, leading to more consistent logic flow.
Upgrade to `react-native-permissions` v5.4.3 or higher which correctly uses `CLLocationManager` instance `authorizationStatus` on iOS >= 14, improving accuracy and compatibility.
Always add the required `Privacy - [Permission Type] Usage Description` keys to your `Info.plist` for iOS, and appropriate `<uses-permission>` tags with reasonable descriptions to your `AndroidManifest.xml` for Android. These descriptions explain to the user why the app needs the permission.
Add the corresponding `NS[PermissionType]UsageDescription` key (e.g., `NSCameraUsageDescription`) and a descriptive string value to your `Info.plist` file in your iOS project.
For iOS, ensure `setup_permissions()` is called in your `Podfile` with the required permissions and run `pod install`. For Android, verify auto-linking or manual linking steps if necessary. Clean build caches and rebuild the app.
Check your `Podfile` for `react-native-permissions/scripts/setup.rb` and `setup_permissions()`. Ensure `pod install` has been run. For Android, verify `MainApplication.java` has `new ReactNativePermissionsPackage()` if not using autolinking. Clear caches and rebuild.
Ensure `react-native-permissions` is installed correctly. For TypeScript, update `tsconfig.json` to include `"moduleResolution": "bundler"` (especially for v5.5.0+) or ensure types are correctly picked up by your IDE and bundler.