@husam287/react-native-draw-overlay
v1.0.0
Published
Ask for draw over other apps permission.
Downloads
3
Readme
react-native-draw-overlay
Ask for draw over other apps permission.
Getting started
$ npm install react-native-draw-overlay --save
Mostly automatic installation
$ react-native link react-native-draw-overlay
Manual installation
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNDrawOverlayPackage;
to the imports at the top of the file - Add
new RNDrawOverlayPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-draw-overlay' project(':react-native-draw-overlay').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-draw-overlay/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:implementation project(':react-native-draw-overlay')
Usage
add
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
to AndroidManifest.xml
import RNDrawOverlay from 'react-native-draw-overlay';
// TODO: What to do with the module?
RNDrawOverlay.askForDispalayOverOtherAppsPermission()
.then(res => {
// res will be true if permission was granted
})
.catch(e => {
// permission was declined
})