It's really weird that when I use sheet inside navigated view from tab item, it always pops back itself.
Description
what I did was :
- Tap
NavigationLinkinside tab item view - Show
sheetfrom the navigated view - Dismiss sheet
- View pops back automatically
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView {
TabView {
NavigationLink(destination: { TestView() }, label: { Text("Navigation link") })
.tabItem {
Image(systemName: "person")
}
}
}
}
}
struct TestView: View {
@State var show = false
var body: some View {
Button(action: { show = true }) {
Text("Navigated view")
}
.sheet(isPresented: $show) {
Text("Sheet view")
}
}
}
Then it happens:
Question
There're 2 requirements I want:
- Tab bar shouldn't be shown when navigate to another view.
- Use
sheetthe inside navigated view, not afullScreenCover.
Is there any way to achieve them without facing the problems? Any advice will be appreciated. Thanks!
