after logout, I log in with another account but the data is still there I have to switch to another screen before going back to that screen to get new data. this is button logout
<Button
title={'Logout'}
style={styles.marginButton}
onPress={async () => {
navigation.navigate('Login');
await AsyncStorage.clear();
}}>
</Button>
CodePudding user response:
Clear asyncStorage before navigate to Login maybe.
CodePudding user response:
Clear the storage data before navigating so place the await AsyncStorage.clear() before navigating
onPress={async () => {
await AsyncStorage.clear();
navigation.navigate('Login');
}}