mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-24 07:09:03 +00:00
[fix] AppState.isSupported -> AppState.isAvailable
React Native exposes AppState support via 'isAvailable'.
This commit is contained in:
@@ -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"',
|
||||
|
||||
Reference in New Issue
Block a user