Skip to content

Commit

Permalink
Fixing sample
Browse files Browse the repository at this point in the history
  • Loading branch information
TimLariviere committed Mar 8, 2024
1 parent d7dc306 commit bdb4cb3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 4 additions & 3 deletions samples/Navigation/ComponentNavigation/Sample.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand All @@ -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)
)
}
6 changes: 5 additions & 1 deletion src/Fabulous.MauiControls/Views/Application.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bdb4cb3

Please sign in to comment.