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);
|
_eventHandlers[type].delete(handler);
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: getCurrentAppState callback seems to be called at a really late stage
|
currentState: (RCTAppState && RCTAppState.initialAppState : ?string),
|
||||||
// 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),
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -96,4 +96,13 @@ RCT_EXPORT_METHOD(getCurrentAppState:(RCTResponseSenderBlock)callback
|
||||||
callback(@[@{@"app_state": _lastKnownState}]);
|
callback(@[@{@"app_state": _lastKnownState}]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - RCTBridgeModule
|
||||||
|
|
||||||
|
- (NSDictionary *)constantsToExport
|
||||||
|
{
|
||||||
|
return @{
|
||||||
|
@"initialAppState" : RCTCurrentAppBackgroundState()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in New Issue