From 9e944207a9ddc9a46681dc7fa6f644f0c864a4a9 Mon Sep 17 00:00:00 2001 From: hariroshan Date: Sat, 14 Jan 2023 19:23:05 +0530 Subject: [PATCH] fixed frame navigation bug --- elm-native/src/Native/Frame.elm | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/elm-native/src/Native/Frame.elm b/elm-native/src/Native/Frame.elm index ee34de1..5fb2c41 100644 --- a/elm-native/src/Native/Frame.elm +++ b/elm-native/src/Native/Frame.elm @@ -2,10 +2,10 @@ module Native.Frame exposing ( Model , TransitionCurve(..) , TransitionName(..) - , back - , current , defaultNavigationOptions , frame + , goTo + , handleBack , init , setAnimated , setBackstackVisible @@ -257,8 +257,8 @@ init currentPage = } -back : Bool -> Model page -> Model page -back isBackNavigation model = +handleBack : Bool -> Model page -> Model page +handleBack isBackNavigation model = if not isBackNavigation then model @@ -267,15 +267,12 @@ back isBackNavigation model = [] -> model - cur :: [] -> - { model | history = [], current = cur } - - _ :: cur :: rest -> + cur :: rest -> { model | history = rest, current = cur } -current : page -> Maybe NavigationOptions -> Model page -> Model page -current page maybeNavigationOptions model = +goTo : page -> Maybe NavigationOptions -> Model page -> Model page +goTo page maybeNavigationOptions model = { model | history = model.current :: model.history , current = page