From 0fb3d8de83c4d8b79a8a110e9cd1300b39ab8918 Mon Sep 17 00:00:00 2001 From: Jiajie Zhu Date: Fri, 25 Sep 2015 13:22:25 -0700 Subject: [PATCH] revert D2372548 to fix initial app state issue Reviewed By: @hedgerwang Differential Revision: D2480492 --- Libraries/AppStateIOS/AppStateIOS.ios.js | 6 +++++- React/Modules/RCTAppState.m | 9 --------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/Libraries/AppStateIOS/AppStateIOS.ios.js b/Libraries/AppStateIOS/AppStateIOS.ios.js index 1d64c7d64..f7dddcd57 100644 --- a/Libraries/AppStateIOS/AppStateIOS.ios.js +++ b/Libraries/AppStateIOS/AppStateIOS.ios.js @@ -122,7 +122,11 @@ var AppStateIOS = { _eventHandlers[type].delete(handler); }, - currentState: (RCTAppState && RCTAppState.initialAppState : ?string), + // 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), }; diff --git a/React/Modules/RCTAppState.m b/React/Modules/RCTAppState.m index 294330643..f9ee2cb33 100644 --- a/React/Modules/RCTAppState.m +++ b/React/Modules/RCTAppState.m @@ -101,13 +101,4 @@ RCT_EXPORT_METHOD(getCurrentAppState:(RCTResponseSenderBlock)callback callback(@[@{@"app_state": _lastKnownState}]); } -#pragma mark - RCTBridgeModule - -- (NSDictionary *)constantsToExport -{ - return @{ - @"initialAppState" : RCTCurrentAppBackgroundState() - }; -} - @end