I would like to call a method to change a value from AsyncStorage. So I tried using AppState to check app is closed.
componentWillMount(){
AppState.addEventListener('change', state => {
if (state === 'active') {
console.log("THIS IS ACTIVE");
} else if (state === 'background') {
console.log("THIS IS BG");
} else if (state === 'inactive') {
console.log("THIS IS INAVTIVE");
}
});
}
However, it not calling to the inactive, am I doing right ? or there is another better way to check the app is closed. Thank a lot