Sextant navigation from ReactiveContentPage to ReactiveFlyoutPage #3721
-
Hello, I'm sort of new to sextant and reactiveUI navigation and I'm facing an issue with a particular navigation flow. I have an app that has an initial login page, where the user clicks to log in and then finally navigates to the MainPage of the app, which is a FlyoutPage. Using I use Sextant to perform this specific flow, and the app just "hangs". The MainFlyout page does get initialized, but the INavigable methods in the ViewModel are never invoked. Therefore, the app just stays on the Login page forever. I tried setting up the resetStack parameter. This is such a common navigation case that I really feel that I'm missing out on something. I'm uploading a zip of a sample app with the current behaviour I'm mentioning. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi Daniel, Sorry we took so long to give you an answer. I took a look at your code and you are calling Sextant uses Observables and requires the execution to be started with a subscription. The code as tested: public class LoginPage : ReactiveContentPage<LoginViewModel>
{
private readonly IViewStackService? _stackService;
public LoginPage()
{
var lgbtn = new Button { Text = "Click to login" };
lgbtn.Clicked += Lgbtn_Clicked;
Content =
new StackLayout
{
Children =
{
new Label{Text = "Login Page <3"},
lgbtn
}
};
_stackService = Locator.Current.GetService<IViewStackService>();
}
private void Lgbtn_Clicked(object? sender, EventArgs e)
{
_stackService?
.PushPage<MainViewModel>(resetStack: true)
.Subscribe();
}
} |
Beta Was this translation helpful? Give feedback.
Hi Daniel,
Sorry we took so long to give you an answer.
I took a look at your code and you are calling
SubscribeOn
instead ofSubscribe
.Sextant uses Observables and requires the execution to be started with a subscription.
SubscribeOn is used to change the Schedular for the subscription to execute on but still requires Subscribe to be called.
There is a handful of situations where SubscribeOn is required as in majority you want the Execution to happen on the Taskpool threads and then most often the Observer wants to receive the result on a UI thread therefore ObserveOn is called before Subscribe to change threads for displaying the result on a user interface. This mechanism is not requir…