1import React from 'react';
2import { View } from 'react-native';
3import * as KeepAwake from 'expo-keep-awake';
4import Button from '../components/Button';
5
6export default class KeepAwakeScreen extends React.Component {
7  static navigationOptions = {
8    title: 'KeepAwake',
9  };
10
11  _activate = () => {
12    KeepAwake.activateKeepAwake();
13  }
14
15  _deactivate = () => {
16    KeepAwake.deactivateKeepAwake();
17  }
18
19  render() {
20    return (
21      <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
22        <Button
23          style={{ marginBottom: 10 }}
24          onPress={this._activate}
25          title="Activate"
26        />
27        <Button onPress={this._deactivate} title="Deactivate" />
28      </View>
29    );
30  }
31}
32