I tried all the examples in the doc but no success.
I have component that I am routing from here to component.
I need to unmount component A.
I've tried REPLACE AND RESET.
RootNavigation.navigationRef.current.dispatch(state => {
return CommonActions.reset({
index: 0,
key: null,
routes: [{ name: 'B' }],
});
});
this code function route me to different route routs in stack['AA','B'] so it routes me to 'AA'
const resetAction = StackActions.replace('B', {});
RootNavigation.navigationRef.current.dispatch(state => {
return resetAction;
});
I AM GETTING AN ERROR he action 'REPLACE' with payload {"name":"B","params":{}} was not handled by any navigator.
RootNavigation.navigate('B');
this function work great but it's not unmounted A.