[fix] AppState.isSupported -> AppState.isAvailable

React Native exposes AppState support via 'isAvailable'.
This commit is contained in:
Nicolas Gallagher
2017-04-21 18:47:29 -07:00
parent 9012e98ba7
commit 66a4c13bf3
+4 -4
View File
@@ -13,10 +13,10 @@ const AppStates = {
const listeners = [];
class AppState {
static isSupported = ExecutionEnvironment.canUseDOM && document.visibilityState;
static isAvailable = ExecutionEnvironment.canUseDOM && document.visibilityState;
static get currentState() {
if (!AppState.isSupported) {
if (!AppState.isAvailable) {
return AppState.ACTIVE;
}
@@ -31,7 +31,7 @@ class AppState {
}
static addEventListener(type: string, handler: Function) {
if (AppState.isSupported) {
if (AppState.isAvailable) {
invariant(
EVENT_TYPES.indexOf(type) !== -1,
'Trying to subscribe to unknown event: "%s"',
@@ -44,7 +44,7 @@ class AppState {
}
static removeEventListener(type: string, handler: Function) {
if (AppState.isSupported) {
if (AppState.isAvailable) {
invariant(
EVENT_TYPES.indexOf(type) !== -1,
'Trying to remove listener for unknown event: "%s"',