I'm working a personal app for myself and I'm making use of the Prism
library and the NavigationService
that it implements.
I have a function called NavigateToFlowAsync()
that is defined as follows:
public async Task NavigateToFlowAsync(){
await NavigationService.GoBackAsync(true);
await NavigationService.NavigateAsync($"{nameof(NavigationPage)}/{nameof(NewPage)}");
}
This function will be called from a page that is part of the modal stack that is being popped with the GoBackAsync(true)
call made in NavigateToFlow()
.
The behavior I'm getting at the moment is that the current page is popped, but the subsequent navigation does not occur.
I've tried debugging and looking at the resulting INavigationResult
that is returned from both of these navigation calls, but in both cases the result is successful.
For example, if my navigation stack looks like this:
NavigationPage (which has been navigated to modally) -> PageOne -> PageTwo -> PageThree
And PageThree contains the NavigateToFlowAsync()
function, I would expect the resulting NavigationStack to look like:
NavigationPage (which has been navigated to modally) -> NewPage
However what it actually looks like is:
NavigationPage (which has been navigated to modally) -> PageOne -> PageTwo
The best theory I have at the moment is the NavigateAsync
call doesn't work because at that point the ViewModel that is making the call corresponds to a page that is no longer in the stack.
Any help would be really appreciated, thank you!
I decided that it would make sense to ask the very people that created Prism about this issue, cause if anyone's gonna have an answer it will be them! Brian Lagunas has said "You can't navigate from a page you just removed from the navigation stack." So there we go, unfortunately what I was after just can't happen. I'll find another way to get around it!