react-native-permission-handler-wrapper
v0.0.1
Published
A lightweight and reusable React Native wrapper component to handle runtime permissions like camera, location, photo library, and notifications — with built-in UI fallback for denied or blocked states.
Maintainers
Readme
Here's the formatted README.md file for your npm package:
# 🚀 react-native-permission-handler-wrapper
A lightweight and reusable **React Native** wrapper component to handle **runtime permissions** like camera, location and photo library — with a fallback modal when access is denied or blocked.
## 📦 Installation
```bash
npm install react-native-permission-handler-wrapper react-native-permissionsDon't forget to follow platform-specific setup for
react-native-permissions: React Native Permissions Setup Guide
⚙️ Supported Permissions
| Type | iOS | Android |
| -------------- | ------------------------ | ---------------------------------- |
| camera | PERMISSIONS.IOS.CAMERA | PERMISSIONS.ANDROID.CAMERA |
| location | LOCATION_WHEN_IN_USE | ACCESS_FINE_LOCATION |
| photo | PHOTO_LIBRARY | READ_MEDIA_IMAGES (Android 13+) |
🧠 Usage
import { PermissionHandler } from 'react-native-permission-handler-wrapper';
import { Text } from 'react-native';
const CameraScreen = () => {
return (
<PermissionHandler type="camera">
<Text>Camera is active 🎥</Text>
</PermissionHandler>
);
};✨ Features
- � Auto-check and request permission on mount
- 📵 Shows modal with message if blocked
- ⚙️ Opens device settings to enable permissions
- ✅ Simple wrapper component — drop-in ready
- 🛡 TypeScript support out of the box
🧩 Props
| Prop | Type | Required | Description |
| ---------- | ----------------------------------------------------- | -------- | ---------------------------------------------- |
| type | 'camera' \| 'location' \| 'photo' | ✅ | The type of permission to request/check |
| children | React.ReactNode | ✅ | The content to render if permission is granted |
🔧 Example Use Cases
- Camera preview access
- Location-based check-in
- Photo upload from gallery
🐞 Issues
If you run into issues or want to request features, open an issue.
👨💻 Author
📜 License
MIT License
📊 Badges
