react-native-screen-idle-timer
v0.1.0
Published
test
Downloads
2
Readme
react-native-screen-idle-timer
Prevent screen fron going to sleep on both iOS and Android.
Installation
npm install react-native-screen-idle-timer
Usage
import ScreenIdleTimer from 'react-native-screen-idle-timer';
// Method 1
class MyComponent extends Component {
render() {
if (this.props.screenShouldBeAwake) {
return (
<View>
<Text>Screen will be kept awake</Text>
<ScreenIdleTimer />
</View>
)
} else {
return (
<View>
<Text>Screen can sleep</Text>
</View>
);
}
}
}
// Method 2
function changeKeepAwake(shouldBeAwake) {
if (shouldBeAwake) {
ScreenIdleTimer.activate();
} else {
ScreenIdleTimer.deactivate();
}
}
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Made with create-react-native-library