Last active
July 28, 2020 19:33
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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