/**
* 关于前后台监听,HOME直接后台不执行component相关周期函数,back
* 后台是执行的,back后返回应该是重新render了,所以监听HOME或者
* BACK可以同一使用APPState的状态码来操作
* APPState是有三个状态码的,有一个不常用就没写
*/
import React, { Component } from 'react';
import {
ToastAndroid,
AppState,
BackHandler,
TouchableHighlight,
Platform,
StyleSheet,
Text,
View,
Alert
} from 'react-native';
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' +
'Cmd+D or shake for dev menu',
android: 'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
});
const lastBackPressed = Date.now();
type S