{"id":15198,"library":"react-native-permissions","title":"React Native Permissions","description":"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.","status":"active","version":"5.5.1","language":"javascript","source_language":"en","source_url":"https://github.com/zoontek/react-native-permissions","tags":["javascript","react-native","react native","react-native-windows","permission","authorization","typescript"],"install":[{"cmd":"npm install react-native-permissions","lang":"bash","label":"npm"},{"cmd":"yarn add react-native-permissions","lang":"bash","label":"yarn"},{"cmd":"pnpm add react-native-permissions","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for React Native applications.","package":"react","optional":false},{"reason":"Core dependency for React Native framework.","package":"react-native","optional":false},{"reason":"Optional peer dependency for Windows platform support.","package":"react-native-windows","optional":true}],"imports":[{"note":"This is a named export, not a default export. Incorrectly importing as a default will result in an undefined function.","wrong":"import request from 'react-native-permissions';","symbol":"request","correct":"import { request } from 'react-native-permissions';"},{"note":"While CommonJS `require` might work in some setups, the library is primarily designed for ES Modules. For optimal bundle size and modern tooling, use `import`.","wrong":"const { check } = require('react-native-permissions');","symbol":"check","correct":"import { check } from 'react-native-permissions';"},{"note":"Contains platform-specific permission constants (e.g., PERMISSIONS.ANDROID.CAMERA, PERMISSIONS.IOS.LOCATION_WHEN_IN_USE).","symbol":"PERMISSIONS","correct":"import { PERMISSIONS } from 'react-native-permissions';"},{"note":"Contains constants for permission statuses (e.g., RESULTS.GRANTED, RESULTS.DENIED, RESULTS.BLOCKED).","symbol":"RESULTS","correct":"import { RESULTS } from 'react-native-permissions';"},{"note":"Often used in conjunction with this library to select platform-specific permissions.","symbol":"Platform","correct":"import { Platform } from 'react-native';"}],"quickstart":{"code":"import { check, request, PERMISSIONS, RESULTS } from 'react-native-permissions';\nimport { Platform, Alert } from 'react-native';\n\nconst getCameraPermission = async () => {\n  let permission;\n  if (Platform.OS === 'ios') {\n    permission = PERMISSIONS.IOS.CAMERA;\n  } else if (Platform.OS === 'android') {\n    permission = PERMISSIONS.ANDROID.CAMERA;\n  } else {\n    Alert.alert('Unsupported platform');\n    return;\n  }\n\n  try {\n    let result = await check(permission);\n    if (result === RESULTS.DENIED) {\n      result = await request(permission);\n    }\n\n    if (result === RESULTS.GRANTED) {\n      Alert.alert('Camera permission granted!');\n    } else if (result === RESULTS.BLOCKED) {\n      Alert.alert('Camera permission blocked', 'Please go to settings to enable camera.');\n    } else {\n      Alert.alert('Camera permission status: ' + result);\n    }\n  } catch (error) {\n    console.error('Permission check failed', error);\n    Alert.alert('Error requesting permission');\n  }\n};\n\n// Call this function from a component or an event handler\n// getCameraPermission();","lang":"typescript","description":"Demonstrates checking and requesting camera permission, handling different statuses across iOS and Android."},"warnings":[{"fix":"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.","message":"Starting with v5.5.0, the package utilizes the `package.json` `exports` property for module resolution. This requires bundlers to be configured correctly.","severity":"breaking","affected_versions":">=5.5.0"},{"fix":"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.","message":"iOS permissions require explicit declaration in the `Podfile` and corresponding usage descriptions in `Info.plist`. Failing to do so will result in runtime crashes or permissions not being available.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"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.","message":"On Android, `check` might return `UNAVAILABLE` for unsupported permissions instead of `DENIED`. This was addressed in v5.4.2.","severity":"gotcha","affected_versions":"<5.4.2"},{"fix":"Upgrade to `react-native-permissions` v5.4.3 or higher which correctly uses `CLLocationManager` instance `authorizationStatus` on iOS >= 14, improving accuracy and compatibility.","message":"When requesting location permissions on iOS 14 and above, granular `LocationAccuracy` (`LocationWhenInUse` or `LocationAlways`) can be requested. Using `CLLocationManager` directly for authorization status on older iOS versions might lead to incorrect behavior.","severity":"gotcha","affected_versions":"<5.4.3"},{"fix":"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.","message":"Missing privacy usage descriptions in `Info.plist` (iOS) or `AndroidManifest.xml` (Android) for requested permissions will cause the app to crash or permissions to be silently denied by the OS.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Add the corresponding `NS[PermissionType]UsageDescription` key (e.g., `NSCameraUsageDescription`) and a descriptive string value to your `Info.plist` file in your iOS project.","cause":"Missing `Info.plist` entry for a requested iOS permission.","error":"This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NS[PermissionType]UsageDescription key with a string value explaining to the user how the app uses this data."},{"fix":"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.","cause":"Native module not linked correctly, or permissions not configured in Podfile for iOS.","error":"`_NativePermissions.check` is null or not an object."},{"fix":"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.","cause":"Similar to the `check` error, indicates the native module isn't properly initialized or linked for the target platform.","error":"Error: `TypeError: null is not an object (evaluating '_NativePermissions.request')`"},{"fix":"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.","cause":"TypeScript cannot find type definitions for the module or `moduleResolution` is incorrect.","error":"Could not find a declaration file for module 'react-native-permissions'. '/node_modules/react-native-permissions/lib/commonjs/index.js' implicitly has an 'any' type."}],"ecosystem":"npm"}