-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.navigationBarHidden(true) seems not work for iOS 15 #4
Comments
Hello, please provide full reproducible SwiftUI view code or project and specify exact iOS version where the problem occurs. |
Sorry, just find that this bug will not be related to this lib. The code as bellow: NavigationStackBackport.NavigationStack(path: $lifeModel.wordNaviPath) {
TabView(selection: $lifeModel.tabTag) {
WordsPagingView()
.navigationBarTitleDisplayMode(.inline)
.navigationTitle("")
.navigationBarHidden(true)
...
This issue occurred when a TabView be embedded in a NavigationView. Even try StackOverflow with no luck. |
@lm import SwiftUI
import NavigationStackBackport
enum TestTab {
case test1
case test2
case test3
}
struct ContentView: View {
@State var selectedTab: TestTab = .test1
var body: some View {
ZStack {
NavigationStackBackport.NavigationStack { // Can't hide the navigation bar
// NavigationView { // Using NavigationView is ok.
TabView(selection: $selectedTab) {
// Tab A
List(1...1000, id: \.self) { i in
Text("Item A: \(i)")
}
.navigationBarHidden(true).navigationBarTitle("a")
.tag(TestTab.test1)
.tabItem { Label("Home", systemImage: "n.circle") }
// Tab B
List(1...1000, id: \.self) { i in
Text("Item B: \(i)")
}
.navigationBarHidden(true).navigationBarTitle("b")
.tag(TestTab.test2)
.tabItem { Label("Stories", systemImage: "book") }
// Tab C
List(1...1000, id: \.self) { i in
Text("Item C: \(i)")
}
.navigationBarHidden(true).navigationBarTitle("c")
.tag(TestTab.test3)
.tabItem { Label("Settings", systemImage: "gear") }
}
}
.navigationViewStyle(StackNavigationViewStyle())
}
}
}
#Preview {
ContentView()
} When I use |
Demo device is an iOS 15 simulator. |
Usually each tab has it's own navigation stack. Could that work for you? it would probably fix issues like this. |
Yes, usually it is. BUT The only issue is the tabBar will appear immediately(with no animation) when pop back. I want it's smooth appear or keep there. So I embed the TabView in the NavigationView. |
Horse888 This code will show navigation bar when you pop from
This code won't show navigation bar when you pop from
|
The navigationBar is there, not be hidden.
The text was updated successfully, but these errors were encountered: