Socket
Socket
Sign inDemoInstall

react-native-permissions

Package Overview
Dependencies
Maintainers
1
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-permissions

An unified permissions API for React Native on iOS, Android and Windows


Version published
Weekly downloads
475K
increased by1.11%
Maintainers
1
Weekly downloads
Β 
Created

What is react-native-permissions?

The react-native-permissions package is a library for handling permissions in React Native applications. It provides a unified API to request and check permissions for various device features such as location, camera, microphone, and more.

What are react-native-permissions's main functionalities?

Requesting Permissions

This feature allows you to request specific permissions from the user. In this example, the code requests camera permission on an Android device.

import { request, PERMISSIONS } from 'react-native-permissions';

async function requestCameraPermission() {
  const result = await request(PERMISSIONS.ANDROID.CAMERA);
  console.log(result);
}

Checking Permissions

This feature allows you to check the current status of a specific permission. The example checks if the camera permission is granted on an Android device.

import { check, PERMISSIONS, RESULTS } from 'react-native-permissions';

async function checkCameraPermission() {
  const result = await check(PERMISSIONS.ANDROID.CAMERA);
  if (result === RESULTS.GRANTED) {
    console.log('Camera permission granted');
  } else {
    console.log('Camera permission not granted');
  }
}

Open App Settings

This feature allows you to open the app settings so the user can manually grant permissions. The example demonstrates how to open the app settings.

import { openSettings } from 'react-native-permissions';

function openAppSettings() {
  openSettings().catch(() => console.warn('Cannot open settings'));
}

Other packages similar to react-native-permissions

Keywords

FAQs

Package last updated on 24 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc