Created
November 12, 2024 17:13
-
-
Save Tunous/53d29c367deb51cb0f7dff3999da3626 to your computer and use it in GitHub Desktop.
Weird TabView in NavigationStack toolbar behavior
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
NavigationStack { | |
TabView { | |
List { | |
Text("Content") | |
} | |
} | |
.ignoresSafeArea(edges: .vertical) | |
.navigationTitle("Title") | |
.tabViewStyle(.page) | |
// Without following line scrollable content behaves incorrectly | |
// Content appears behind toolbar and scrolling doesn't update visibility of toolbar background | |
.background(Representable()) | |
} | |
} | |
} | |
struct Representable: UIViewRepresentable { | |
func makeUIView(context: Context) -> some UIView { | |
return UIView() | |
} | |
func updateUIView(_ uiView: UIViewType, context: Context) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment