I almost searched everywhere about BackHandler in react-native but could not get much information about this.
I have 4 screens -
1) Splash screen that decides if I don't have a login token go to login screen else to home screen
2) login screen
3) home screen
4) detail screen
2 scenarios -
1) When I am logged in, I am in the home screen. Clicking on an item in home screen will take me to the detail screen.
So in detail screen, I press back button, I goto Home screen and pressing back button in Home screen will exit the app.
2) When I am not logged in, I am in the login screen. Pressing back button shall exit the app.
How should I use the BackHandler for the above scenario?
onPress={() => navigate('home ')}- Aravind S