Skip to content

Instantly share code, notes, and snippets.

@edsonmsantos
Last active July 28, 2020 19:33
Show Gist options
  • Save edsonmsantos/01f5a16598ef281c65c4642449d0501c to your computer and use it in GitHub Desktop.
Save edsonmsantos/01f5a16598ef281c65c4642449d0501c to your computer and use it in GitHub Desktop.
[Remove tela do histórico] Código para remover tela do histórico do react navigation / stack
import {CommonActions} from '@react-navigation/native';
//use mode: RemoveFromHistory.remove(this.props, 'Preload');
export default {
remove: (props, routesToRemove) => {
const newRoutes = [];
props.navigation.dispatch(state => {
const routes = state.routes.filter(r => r.name !== routesToRemove);
return CommonActions.reset({
...state,
routes,
index: routes.length - 1,
});
});
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment