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