Nested horizontal ScrollView has invisible padding from the top. I've tried to add ".padding(.top, 0)" for the ScrollView and for the content, but it doesn't work. Is it a bug or it is possible to remove this padding?
VStack(alignment: .leading) {
Text("Text one")
Text("Text two")
ScrollView(.horisontal, showsIndicators: false) {
Text("Text with strange top padding")
}
}.padding(.horizontal)
I don't know what is ScrollingView but with standard ScrollView provided example works well (tested with Xcode 11.2 / iOS 13.2)
Here is a demo with added border around scroll view for better visibility
struct TestHorizontalScrollView: View {
var body: some View {
VStack(alignment: .leading, spacing: 0) {
Text("Text one")
Text("Text two")
ScrollView(.horizontal) {
Text("Text with strange top padding")
}.border(Color.red)
}.padding(.horizontal)
}
}

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With