React native kiosk mode functionality for Android
A simple react native plugin to achieve kiosk mode (immersive mode) on android
Props: KioskMode
import {Immersive} from 'react-native-kiosk-mode'
Android Installation
Install the npm package react-native-kiosk-mode
. Inside your React Native project, run (example):
npm install --save react-native-kiosk-mode
In android/settings.gradle
, remove the line include ':app'
and add the following lines
include ':react-native-kiosk-mode'
project(':react-native-kiosk-mode').projectDir = file('../node_modules/react-native-kiosk-mode/android')
NOTE : If you have included other libraries in your project, the include
line will contain the other dependencies too.
In android/app/build.gradle
, add a dependency to ':react-native-kiosk-mode'
dependencies {
compile project(':react-native-kiosk-mode')
}
Next, you need to change the MainActivity
of your app to register KioskModeModule
:
// add this import
Next, you need to add the onWindowFocusChanged
function to your Apps MainActivity.java
:
// add this import //...
Android kiosk mode for react native by Seyi Ogunbowale