AppState change doesn't fire on launch on iOS
Description
AppState's change event is not getting fired on the first launch on iOS but it is on Android.
React Native version:
System:
OS: macOS 11.5.1
CPU: (8) arm64 Apple M1
Memory: 115.61 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.5.0 - /opt/homebrew/bin/node
Yarn: 1.22.5 - /usr/local/bin/yarn
npm: 7.19.1 - /opt/homebrew/bin/npm
Watchman: 2021.06.07.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.10.1 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild
Languages:
Java: 13.0.1 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: 0.64.2 => 0.64.2
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
- Open the app on Android and see the event being fired
- Open the app on iOS and see the event not being fired
Expected Results
- Both OS behaving the same way
Snack, code example, screenshot, or link to a repository:
AppState.addEventListener('change', newState => {
console.log('new state', newState);
});
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Is anyone else facing this problem?
I see the same issue in React-Native 65. In addition, the transition from background => active does not get triggered for iOS
i also face this issue
@gabrieldonadel i have same issue
Facing the same issue :(
I have the some problem.In Android,when I first launched the app,AppState.addEventListener('change', newState => { console.log('new state', newState); }); these codes executed,but In IOS,these codes somtimes executed,but sometimes not executed,Is anyone have the same problem?
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.
i have same problem