davdroman / swiftui-navigation-transitions

Pure SwiftUI Navigation transitions ✨

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Navigation bar disappears after rotating device in destination view and coming back

AbelToy opened this issue · comments

Can be reproduced in iOS 17 using Xcode 15. Not sure about other versions.

I have a NavigationStack inside a sheet.

Inside that NavigationStack, I navigate to a destination using the following transition:

.navigationTransition(.fade)

If I reproduce the following behaviors:

  • Open the sheet in portrait mode
  • Navigate to the destination in portrait mode
  • Switch to landscape mode
  • Navigate back to the previous screen

The navigation bar will be hidden.

I was wondering if there is a workaround to fix this, or if a fix could be introduced for this.

Many thanks!

Yup, I was able to reproduce it.

Not sure why this happens with a custom transition and not with the default transition, but it's easily fixable by forcing nav bar to always be visible as follows:

NavigationStack {
    YourContentView()
        .toolbar(.visible, for: .navigationBar)
}
.navigationTransition(.fade(.cross))

Let me know if this works for you.

@davdroman Sorry for the late reply. The workaround seems to work fine!! Thanks :)