Skip to content
This repository was archived by the owner on Nov 11, 2024. It is now read-only.

Commit 77566a3

Browse files
committed
fix: AppState "change" event
1 parent 0c665c0 commit 77566a3

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

React/Modules/RCTAppState.m

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,12 @@
1616

1717
static NSString *RCTCurrentAppBackgroundState()
1818
{
19-
static NSDictionary *states;
20-
static dispatch_once_t onceToken;
21-
dispatch_once(&onceToken, ^{
22-
states = @{
23-
// @(NSApplication): @"active",
24-
// @(UIApplicationStateBackground): @"background",
25-
// @(UIApplicationStateInactive): @"inactive"
26-
};
27-
});
28-
2919
if (RCTRunningInAppExtension()) {
3020
return @"extension";
3121
}
3222

33-
//return states[@(RCTSharedApplication().applicationState)] ?: @"unknown";
34-
return @"unknown";
23+
NSApplication *app = RCTSharedApplication();
24+
return app.active ? @"active" : @"inactive";
3525
}
3626

3727
@implementation RCTAppState

0 commit comments

Comments
 (0)