react-navigation
react-navigation copied to clipboard
How to block app exit when i press android hardware back button on top level of navigation
TabNavigationIndex.router.getStateForAction = (action, state) => {
if(state && state.index == 0 && action.type == 'Navigation/BACK'){
}
return defaultGetStateForAction(action, state);
};
in this function how to block app exit
Generally returning true while prevent the app exit.
but when i return true it remind me such as this 'Cannot read property 'forEach' of undefine'
return state;
yes i have solved this problem by ' return { ...state, index: state.routes.length - 1, };'