1.0.4 • Published 1 year ago
mkdm-rn-permissions v1.0.4
EASY INTEGRATION PERMISSIONS PROVIDER FOR REACT NATIVE
Push notifications and devices capabilities permissions ready to use for every react native project.
import * as React from "react";
import RNPermissionProvider from "mkdm-rn-permissions";
export default function App() {
const sendPushTokenToServer = async (token) => {
try {
//Send pusk token to store it in db.
} catch {}
};
const onPermissionError = (error) => console.log(error);
return (
<RNPermissionProvider
camera={true}
microphone={false}
notifications={true}
handlePushToken={sendPushTokenToServer}
handleError={onPermissionError}
>
{/*
The rest of your app goes here
*/}
</RNPermissionProvider>
);
}
Initialization
First run...
yarn add expo-notifications expo-camera
Or
npm i expo-notifications expo-camera
And...
yarn add mkdm-rn-permissions
Properties and Methods
PROPERTIES | TYPE | Default | Description |
---|---|---|---|
camera | boolean | false | If true, camera permission will be display at first app launch. |
microphone | boolean | false | If true, microphone permission will be display at first app launch. |
notifications | boolean | false | If true,push notifications permission will be display at first app launch. |
METHODS | Description |
---|---|
handlePushToken | Get push token as param |
handleError | Get error message as param |
handleNotification | Get Notification object as param |
handleNotificationResponse | Get NotificationResponse object as param |