react-native/React/Modules
Adam Comella 68b0ce657e iOS: Provide correct initial value for AppState.currentState
Summary:
Attempt to fix #7919.

Currently, if the app is launched into the background and you read `AppState.currentState` too soon, you will see the value `'active'` instead of `'background'`. This is because the default value of `AppState.currentState` is hardcoded to be `'active'` and it is initialized with the actual value asynchronously.

This attempts to fix the bug by having the `RCTAppState` module provide the initial state as a module constant.

As noted in #7919, it looks like this fix was already tried and reverted with 0fb3d8de83. zjj010104, hedgerwang, nicklockwood -- can you explain why? I would very much like to get this bug fixed. Nobody has followed up on the issue I filed so I decided to just go ahead and make a PR with my best guess at a fix.

**Test plan (required)**

Built a small app as described in the repro steps for #7919 and verified that, when the app is launched into the background, `init currentState: background` is printed. Also verified that  `i
Closes https://github.com/facebook/react-native/pull/8058

Differential Revision: D3554619

fbshipit-source-id: 5d950b85e335765552bbd3cf6ed91534062e35a1
2016-07-12 23:28:22 -07:00
..
RCTAccessibilityManager.h Replaced RCTSparseArray with NSDictionary 2015-11-14 10:28:28 -08:00
RCTAccessibilityManager.m Update RCTNetworking, RCTNetInfo and RCTLocationManager to use new events system 2016-05-25 04:28:36 -07:00
RCTAlertManager.h Remove an existing UIAlertViews when invalidating the RCTAlertManager 2015-09-18 08:45:27 -07:00
RCTAlertManager.m ActionSheetIOS - support share sheet on modals 2016-05-20 17:13:21 -07:00
RCTAppState.h Updated AppState module to use new emitter system 2016-05-23 09:13:37 -07:00
RCTAppState.m iOS: Provide correct initial value for AppState.currentState 2016-07-12 23:28:22 -07:00
RCTAsyncLocalStorage.h Added lightweight generic annotations 2015-11-03 14:49:30 -08:00
RCTAsyncLocalStorage.m Automated changes to remove implicit capture of self in blocks: Libraries/FBReactKit/BUCK 2016-07-07 12:44:14 -07:00
RCTClipboard.h add Clipboard component for ios and android 2015-12-09 10:04:21 -08:00
RCTClipboard.m Minor fixes to clipboard and Linking to remove TODOs 2016-02-10 12:25:51 -08:00
RCTDevLoadingView.h [RCTDevLoadingView] Add ability to disable during development. 2015-09-04 03:46:06 -08:00
RCTDevLoadingView.m Automated changes to remove implicit capture of self in blocks: Libraries/FBReactKit/BUCK 2016-07-07 12:44:14 -07:00
RCTDevMenu.h Refactor hot loading implementation on iOS 2016-01-04 10:40:32 -08:00
RCTDevMenu.m Automated changes to remove implicit capture of self in blocks: Libraries/FBReactKit/BUCK 2016-07-07 12:44:14 -07:00
RCTEventEmitter.h Added native event emitter 2016-05-11 06:27:29 -07:00
RCTEventEmitter.m Update RCTNetworking, RCTNetInfo and RCTLocationManager to use new events system 2016-05-25 04:28:36 -07:00
RCTExceptionsManager.h Refactored module access to allow for lazy loading 2015-11-25 04:49:45 -08:00
RCTExceptionsManager.m Replaced RegExp method parser with recursive descent 2015-12-10 10:12:29 -08:00
RCTI18nManager.h Move Bridge functions to OSS -- RTL experiment 2016-07-06 16:28:41 -07:00
RCTI18nManager.m Move Bridge functions to OSS -- RTL experiment 2016-07-06 16:28:41 -07:00
RCTI18nUtil.h Change forceRTL to allowRTL 2016-06-27 12:58:21 -07:00
RCTI18nUtil.m Change forceRTL to allowRTL 2016-06-27 12:58:21 -07:00
RCTKeyboardObserver.h Added native event emitter 2016-05-11 06:27:29 -07:00
RCTKeyboardObserver.m Added native event emitter 2016-05-11 06:27:29 -07:00
RCTRedBox.h Display JS exceptions and stacks in a red box. 2016-06-30 19:43:28 -07:00
RCTRedBox.m Cleanup warnings 2016-07-12 05:59:12 -07:00
RCTSourceCode.h Remove SourceCode.getScriptText 2016-06-07 11:13:32 -07:00
RCTSourceCode.m Remove SourceCode.getScriptText 2016-06-07 11:13:32 -07:00
RCTStatusBarManager.h Added native event emitter 2016-05-11 06:27:29 -07:00
RCTStatusBarManager.m Added native event emitter 2016-05-11 06:27:29 -07:00
RCTTiming.h [ReactNative] Use a single DisplayLink held by the bridge 2015-04-15 07:07:48 -08:00
RCTTiming.m Cleanup warnings 2016-07-12 05:59:12 -07:00
RCTUIManager.h Expose UIManager queue via a static function to prevent race conditions 2016-05-16 08:13:21 -07:00
RCTUIManager.m Cleanup warnings 2016-07-12 05:59:12 -07:00