I tried to use this: this.props.navigation.navigatie('Screen') it works but it keep the old screen active in the background. I am using a barcode scanner and i don't want it to drain energy by running in the backgroun.
You need to use the reset
method from stack actions :
import { StackActions, NavigationActions } from 'react-navigation';
const resetAction = StackActions.reset({
index: 0,
actions: [NavigationActions.navigate({ routeName: 'Profile' })],
});
this.props.navigation.dispatch(resetAction);