1 | // @flow
|
2 |
|
3 | import { Component } from 'react';
|
4 | import { NativeModules } from 'react-native';
|
5 |
|
6 | const { ExponentKeepAwake } = NativeModules;
|
7 |
|
8 | export default class KeepAwake extends Component {
|
9 | static activate = ExponentKeepAwake.activate;
|
10 | static deactivate = ExponentKeepAwake.deactivate;
|
11 |
|
12 | componentDidMount() {
|
13 | ExponentKeepAwake.activate();
|
14 | }
|
15 |
|
16 | componentWillUnmount() {
|
17 | ExponentKeepAwake.deactivate();
|
18 | }
|
19 |
|
20 | render() {
|
21 | return null;
|
22 | }
|
23 | }
|