AppState goes background on power button press.
But does not fired when app is activated.
Platform: IOS
package.json
<code> {
"dependencies": {
"@expo/prebuild-config": "^7.0.3",
"@react-native-async-storage/async-storage": "1.23.1",
"@react-native-community/datetimepicker": "^8.0.1",
"@react-native-community/netinfo": "11.3.1",
"@react-navigation/native": "^6.1.6",
"@react-navigation/native-stack": "^6.9.12",
"@shopify/flash-list": "1.6.4",
"axios": "^1.7.2",
"babel-plugin-module-resolver": "^5.0.2",
"base-64": "^1.0.0",
"create-react-class": "^15.7.0",
"crypto-js": "^4.1.1",
"eas-cli": "^0.49.0",
"expo": "^51.0.8",
"expo-barcode-scanner": "~13.0.1",
"expo-build-properties": "~0.12.1",
"expo-camera": "^15.0.9",
"expo-checkbox": "~3.0.0",
"expo-constants": "~16.0.1",
"expo-image-picker": "^15.0.5",
"expo-linking": "~6.3.1",
"expo-location": "~17.0.1",
"expo-secure-store": "~13.0.1",
"expo-status-bar": "~1.12.1",
"metro-react-native-babel-preset": "^0.77.0",
"project-can-json": "^1.0.1",
"project-react-accordion": "^1.0.4",
"project-react-mvc": "^1.5.4",
"project-rest-client": "^1.2.7",
"react": "18.2.0",
"react-native": "^0.74.1",
"react-native-check-version": "^1.1.1",
"react-native-device-info": "^10.13.1",
"react-native-dotenv": "^3.4.9",
"react-native-fetch-api": "^3.0.0",
"react-native-get-random-values": "~1.11.0",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-reanimated": "~3.10.1",
"react-native-render-html": "^6.3.4",
"react-native-safe-area-context": "4.10.1",
"react-native-screens": "3.31.1",
"react-native-sse": "^1.2.1",
"react-native-store-version": "^1.4.1",
"react-native-url-polyfill": "^2.0.0",
"react-native-uuid": "^2.0.1",
"react-native-webview": "13.8.6"
},
"devDependencies": {
"@babel/core": "^7.20.0"
},
"private": true
}
</code>
<code> {
"dependencies": {
"@expo/prebuild-config": "^7.0.3",
"@react-native-async-storage/async-storage": "1.23.1",
"@react-native-community/datetimepicker": "^8.0.1",
"@react-native-community/netinfo": "11.3.1",
"@react-navigation/native": "^6.1.6",
"@react-navigation/native-stack": "^6.9.12",
"@shopify/flash-list": "1.6.4",
"axios": "^1.7.2",
"babel-plugin-module-resolver": "^5.0.2",
"base-64": "^1.0.0",
"create-react-class": "^15.7.0",
"crypto-js": "^4.1.1",
"eas-cli": "^0.49.0",
"expo": "^51.0.8",
"expo-barcode-scanner": "~13.0.1",
"expo-build-properties": "~0.12.1",
"expo-camera": "^15.0.9",
"expo-checkbox": "~3.0.0",
"expo-constants": "~16.0.1",
"expo-image-picker": "^15.0.5",
"expo-linking": "~6.3.1",
"expo-location": "~17.0.1",
"expo-secure-store": "~13.0.1",
"expo-status-bar": "~1.12.1",
"metro-react-native-babel-preset": "^0.77.0",
"project-can-json": "^1.0.1",
"project-react-accordion": "^1.0.4",
"project-react-mvc": "^1.5.4",
"project-rest-client": "^1.2.7",
"react": "18.2.0",
"react-native": "^0.74.1",
"react-native-check-version": "^1.1.1",
"react-native-device-info": "^10.13.1",
"react-native-dotenv": "^3.4.9",
"react-native-fetch-api": "^3.0.0",
"react-native-get-random-values": "~1.11.0",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-reanimated": "~3.10.1",
"react-native-render-html": "^6.3.4",
"react-native-safe-area-context": "4.10.1",
"react-native-screens": "3.31.1",
"react-native-sse": "^1.2.1",
"react-native-store-version": "^1.4.1",
"react-native-url-polyfill": "^2.0.0",
"react-native-uuid": "^2.0.1",
"react-native-webview": "13.8.6"
},
"devDependencies": {
"@babel/core": "^7.20.0"
},
"private": true
}
</code>
{
"dependencies": {
"@expo/prebuild-config": "^7.0.3",
"@react-native-async-storage/async-storage": "1.23.1",
"@react-native-community/datetimepicker": "^8.0.1",
"@react-native-community/netinfo": "11.3.1",
"@react-navigation/native": "^6.1.6",
"@react-navigation/native-stack": "^6.9.12",
"@shopify/flash-list": "1.6.4",
"axios": "^1.7.2",
"babel-plugin-module-resolver": "^5.0.2",
"base-64": "^1.0.0",
"create-react-class": "^15.7.0",
"crypto-js": "^4.1.1",
"eas-cli": "^0.49.0",
"expo": "^51.0.8",
"expo-barcode-scanner": "~13.0.1",
"expo-build-properties": "~0.12.1",
"expo-camera": "^15.0.9",
"expo-checkbox": "~3.0.0",
"expo-constants": "~16.0.1",
"expo-image-picker": "^15.0.5",
"expo-linking": "~6.3.1",
"expo-location": "~17.0.1",
"expo-secure-store": "~13.0.1",
"expo-status-bar": "~1.12.1",
"metro-react-native-babel-preset": "^0.77.0",
"project-can-json": "^1.0.1",
"project-react-accordion": "^1.0.4",
"project-react-mvc": "^1.5.4",
"project-rest-client": "^1.2.7",
"react": "18.2.0",
"react-native": "^0.74.1",
"react-native-check-version": "^1.1.1",
"react-native-device-info": "^10.13.1",
"react-native-dotenv": "^3.4.9",
"react-native-fetch-api": "^3.0.0",
"react-native-get-random-values": "~1.11.0",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-reanimated": "~3.10.1",
"react-native-render-html": "^6.3.4",
"react-native-safe-area-context": "4.10.1",
"react-native-screens": "3.31.1",
"react-native-sse": "^1.2.1",
"react-native-store-version": "^1.4.1",
"react-native-url-polyfill": "^2.0.0",
"react-native-uuid": "^2.0.1",
"react-native-webview": "13.8.6"
},
"devDependencies": {
"@babel/core": "^7.20.0"
},
"private": true
}
js code
<code>let appStateSubscription_3 = undefined;
if (appStateSubscription_3 !== undefined) appStateSubscription_3.remove();
appStateSubscription_3 = AppState.addEventListener('change', nextAppState => {
console.log('APP.JS CHANGE:' + nextAppState);
});
</code>
<code>let appStateSubscription_3 = undefined;
if (appStateSubscription_3 !== undefined) appStateSubscription_3.remove();
appStateSubscription_3 = AppState.addEventListener('change', nextAppState => {
console.log('APP.JS CHANGE:' + nextAppState);
});
</code>
let appStateSubscription_3 = undefined;
if (appStateSubscription_3 !== undefined) appStateSubscription_3.remove();
appStateSubscription_3 = AppState.addEventListener('change', nextAppState => {
console.log('APP.JS CHANGE:' + nextAppState);
});
console result:
LOG APP.JS CHANGE:inactive
LOG APP.JS CHANGE:background
expected console result:
APP.JS CHANGE:active
there is nothing to add