Navigation with StackState: Replace an element in StackState by index while maintaining default slide animation #3276
Unanswered
jessedoescode
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Hi @jessedoescode, I believe the reason you are losing animation is because you are creating a whole new stack element for the path, which has a new underlying stack element ID. Have you tried other ways to remove all but the first element without reconstructing the first element? Something like this: state.path.removeLast(state.path.count - 1) ? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
I'm looking to achieve this navigation flow:
From root view A, push an element B into StackState. From B, I push C into StackState, but from C I would like to have view dismissal lead back to A.
I've been playing around with different
RangeReplaceableCollection
methods, such as:This works in achieving the desired navigation flow, where C goes back A as B gets replaced, but loses the default NavigationStack slide animation. If I use modifier
.animation(.default, value: viewStore.path)
I can use transitions, but I would like to have the default one.Any way to achieve this? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions