Skip to content

gijoehosaphat/react-native-keep-screen-on

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-keep-screen-on

Allows for the selective toggling of the KEEP_SCREEN_ON flag (Android) and the setIdleTimerDisabled flag (iOS).

Installation

npm install react-native-keep-screen-on --save

Configuration

With rnpm

Just run rnpm link react-native-keep-screen-on

Manually

In settings.gradle add the following lines:

include ':KeepScreenOn'
project(':KeepScreenOn').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-keep-screen-on/android')

In build.gradle add the following line:

compile project(':KeepScreenOn')

< [0.29] : In MainActivity.java add the following lines:

import com.gijoehosaphat.keepscreenon.KeepScreenOnPackage;
new KeepScreenOnPackage(this)

>= [0.29] : In MainApplication.java add the following lines:

import com.gijoehosaphat.keepscreenon.KeepScreenOnPackage;
new KeepScreenOnPackage(this)

Example usage:

import KeepScreenOn from 'react-native-keep-screen-on'
...
//Keep screen on...
KeepScreenOn.setKeepScreenOn(true)

//Reset to default behavior...
KeepScreenOn.setKeepScreenOn(false)

About

Allows for the selective toggling of the KEEP_SCREEN_ON flag.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published