Allows for the selective toggling of the KEEP_SCREEN_ON flag (Android) and the setIdleTimerDisabled flag (iOS).
npm install react-native-keep-screen-on --save
With rnpm
Just run rnpm link react-native-keep-screen-on
include ':KeepScreenOn'
project(':KeepScreenOn').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-keep-screen-on/android')
compile project(':KeepScreenOn')
import com.gijoehosaphat.keepscreenon.KeepScreenOnPackage;
new KeepScreenOnPackage(this)
import com.gijoehosaphat.keepscreenon.KeepScreenOnPackage;
new KeepScreenOnPackage(this)
import KeepScreenOn from 'react-native-keep-screen-on'
...
//Keep screen on...
KeepScreenOn.setKeepScreenOn(true)
//Reset to default behavior...
KeepScreenOn.setKeepScreenOn(false)