Use native initialAppState to init app_state for AppStateIOS.

This commit is contained in:
Alexey Lang 2015-08-25 09:08:44 -07:00
Родитель 245a5b8e8c
Коммит 2d2252cd50
2 изменённых файлов: 10 добавлений и 5 удалений

Просмотреть файл

@ -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