react-native/React
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
..
Base Cleanup warnings 2016-07-12 05:59:12 -07:00
Executors Read within bounds of `NSData` object 2016-07-12 10:13:24 -07:00
Layout Revert land of css-layout PR #199 2016-07-08 16:48:13 -07:00
Modules iOS: Provide correct initial value for AppState.currentState 2016-07-12 23:28:22 -07:00
Profiler Automated changes to remove implicit capture of self in blocks: Libraries/FBReactKit/BUCK 2016-07-07 12:44:14 -07:00
React.xcodeproj Class for JS stack frames instead of dictionaries 2016-07-11 06:13:32 -07:00
Views Cleanup warnings 2016-07-12 05:59:12 -07:00