diff --git a/samples/Navigation/ComponentNavigation/Sample.fs b/samples/Navigation/ComponentNavigation/Sample.fs index 53f9f79..a006bf0 100644 --- a/samples/Navigation/ComponentNavigation/Sample.fs +++ b/samples/Navigation/ComponentNavigation/Sample.fs @@ -33,7 +33,7 @@ module Sample = nav.NavigationRequested.Subscribe(fun route -> dispatch(NavigationMsg route)) let backNavRequestedSub dispatch = - nav.BackNavigationRequested.Subscribe(fun () -> dispatch BackButtonPressed) + nav.BackNavigationRequested.Subscribe(fun () -> dispatch BackNavigationMsg) [ [ nameof navRequestedSub ], navRequestedSub [ nameof backNavRequestedSub ], backNavRequestedSub ] @@ -56,11 +56,12 @@ module Sample = (NavigationPage() { // We inject in the NavigationPage history the back stack of our navigation for navPath in List.rev model.Navigation.BackStack do - (navView nav appMsgDispatcher navPath).hasBackButton(false) + navView nav appMsgDispatcher navPath // The page currently displayed is the one on top of the stack - (navView nav appMsgDispatcher model.Navigation.CurrentPage).hasBackButton(false) + navView nav appMsgDispatcher model.Navigation.CurrentPage }) .onBackButtonPressed(BackButtonPressed) + .onBackNavigated(BackNavigationMsg) ) } diff --git a/src/Fabulous.MauiControls/Views/Application.fs b/src/Fabulous.MauiControls/Views/Application.fs index 5b39a39..a5551b3 100644 --- a/src/Fabulous.MauiControls/Views/Application.fs +++ b/src/Fabulous.MauiControls/Views/Application.fs @@ -46,7 +46,11 @@ type FabApplication() = override this.OnAppLinkRequestReceived(uri) = appLinkRequestReceived.Trigger(this, uri) - override this.CreateWindow(activationState) = windows[0] + override this.CreateWindow(activationState) = + if windows.Count > 0 then + windows[0] + else + base.CreateWindow(activationState) override this.OpenWindow(window) = windows.Add(window)