Use native initialAppState to init app_state for AppStateIOS.
This commit is contained in:
parent
245a5b8e8c
commit
2d2252cd50
|
@ -122,11 +122,7 @@ var AppStateIOS = {
|
|||
_eventHandlers[type].delete(handler);
|
||||
},
|
||||
|
||||
// TODO: getCurrentAppState callback seems to be called at a really late stage
|
||||
// after app launch. Trying to get currentState when mounting App component
|
||||
// will likely to have the initial value here.
|
||||
// Initialize to 'active' instead of null.
|
||||
currentState: ('active' : ?string),
|
||||
currentState: (RCTAppState && RCTAppState.initialAppState : ?string),
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -96,4 +96,13 @@ RCT_EXPORT_METHOD(getCurrentAppState:(RCTResponseSenderBlock)callback
|
|||
callback(@[@{@"app_state": _lastKnownState}]);
|
||||
}
|
||||
|
||||
#pragma mark - RCTBridgeModule
|
||||
|
||||
- (NSDictionary *)constantsToExport
|
||||
{
|
||||
return @{
|
||||
@"initialAppState" : RCTCurrentAppBackgroundState()
|
||||
};
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue