[ad_1]
I have centered my Scroll View by using GeometryReader like this:
struct ContentView: View {
var body: some View {
NavigationView {
GeometryReader { geom in
ScrollView(.vertical, showsIndicators: false) {
ZStack {
my_super_view()
}
.navigationBarTitle("Main")
.frame(width: geom.size.width)
.frame(minHeight: geom.size.height)
}
}
}.navigationViewStyle(StackNavigationViewStyle())
}
}
And it works almost great. My problem is that the height of container ZStack is too big and the page could be scrolled down like this:
And when i try to do smth like:
.frame(minHeight: geom.size.height-52)
The page stops scrolling, but is poorly centered. How can I properly center the page so that it fits entirely on the main screen without scrolling below it?
[ad_2]