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