react-native/Libraries
Brent Erickson f99ca3c03f Fix a race condition in AppState that prevents listeners from being notified
Summary:
If someone has setup a subscription on AppState and we correct AppState via getCurrentAppState call, we need to notify all the subscribers of AppState.
1 ) Initial AppState.currentState = 'active'
2-start) Subscribe to AppState Changes
3-start) Fetch Current AppState
4 ) App Code subscribes to AppState module
5 ) App becomes backgrounded
2-finish) AppState listeners are setup (missing background event)
3-finish) AppState.currentState updated to background

At this point the subscription setup in 4) will never be called with the change.

AppState should always call subscribers on change

This is very difficult to formally test since it's due to a race condition. We've seen this condition via bug reports but have had no local repro.

[GENERAL][BUGFIX][AppState] - Fix a race condition that could prevent AppState subscription change listener from firing on initial launch
Closes https://github.com/facebook/react-native/pull/18236

Differential Revision: D7823370

Pulled By: hramos

fbshipit-source-id: 99b174df70262ceaf9da141d005131facd624594
2018-04-30 18:01:17 -07:00
..
ART Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
ActionSheetIOS Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
Alert Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
Animated Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
AppState Fix a race condition in AppState that prevents listeners from being notified 2018-04-30 18:01:17 -07:00
BatchedBridge Add args to bridge function call systrace markers 2018-04-30 09:55:49 -07:00
Blob Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
BugReporting Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
CameraRoll Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
Color Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
Components Removed some @providesModule tags and references 2018-04-26 06:02:00 -07:00
Core Introduce "Options" argument to "fetchSegment()" function 2018-04-27 15:14:36 -07:00
EventEmitter Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
Experimental Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
Geolocation Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
Image Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
Inspector Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
Interaction Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
JSInspector Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
LayoutAnimation Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
Linking Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
LinkingIOS Update license headers for MIT license 2018-02-16 18:31:53 -08:00
Lists Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
Modal Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
NativeAnimation Fix tvOS build breakage in RCTAnimation Xcode project 2018-04-02 22:33:45 -07:00
Network Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
Performance Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
PermissionsAndroid Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
PushNotificationIOS Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
RCTTest Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
ReactNative Make UIManager prepackable 2018-04-27 19:16:53 -07:00
Renderer Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
Sample Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
Settings Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
Share Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
Storage Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
StyleSheet Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
SurfaceBackedComponent Update license headers for MIT license 2018-02-16 18:31:53 -08:00
SurfaceHostingComponent Update license headers for MIT license 2018-02-16 18:31:53 -08:00
Text Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
Types Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
Utilities improve console logging 2018-04-30 11:52:57 -07:00
Vibration Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
WebSocket Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
Wrapper Update additional license headers 2018-03-08 12:10:14 -08:00
fishhook Merge fishhook.xcodeproj in RCTWebSocket 2017-08-09 07:48:09 -07:00
polyfills Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
react-native Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
vendor Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
.npmignore npmignore: ignore tests and fixtures 2018-02-27 08:42:14 -08:00
Promise.js Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
UTFSequence.js Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
promiseRejectionIsError.js Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00