expo
Version:
The Expo SDK
24 lines (17 loc) • 457 B
JavaScript
// @flow
import { Component } from 'react';
import { NativeModules } from 'react-native';
const { ExponentKeepAwake } = NativeModules;
export default class KeepAwake extends Component {
static activate = ExponentKeepAwake.activate;
static deactivate = ExponentKeepAwake.deactivate;
componentDidMount() {
ExponentKeepAwake.activate();
}
componentWillUnmount() {
ExponentKeepAwake.deactivate();
}
render() {
return null;
}
}