How do i set full height on a component in a scroll view?

If you want it to be full screen and ignoring safe area you can set the UserCard‘s height to screen height like this:

VStack(){
   Image()
   Text("long text")
}
.frame(height: UIScreen.main.bounds.height)

And if you want it to respect safe area you could use a GeometryReader:

GeometryReader { geometry in
    ScrollView {
        Color.red
            .frame(height: geometry.size.height)
        Color.blue
            .frame(height: geometry.size.height)
        Color.yellow
            .frame(height: geometry.size.height)
    }
}

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top