0

Below is the code.Why do I get the "padding" beside my list ? How do I get rid of it ?

import SwiftUI

struct MedicalList: View {
    var body: some View {
        NavigationView{
            VStack(spacing:0){
                test()
                VStack{
                    List{
                        Text("haha")
                    }
                }
            }.navigationBarHidden(true)
            
        }.background(Color.gray.opacity(0.3))
        
    }
}

Screenshot of "NavigationView Padding"

  • Try `List { Text("haha") }.listStyle(PlainListStyle())` – aheze Mar 27 '21 at 06:35
  • 1
    @aheze yes this works like a charm. – Eds_lim Mar 27 '21 at 07:02
  • @Andrew thanks Andrew for pointing out to the link.. it solved the problem. As this code is navigation view link to another navigation, another method is to remove the second navigation view to avoid the border.. but it depends on what coders wanted to do.. any thanks ! very prompt respond from you – Eds_lim Mar 27 '21 at 07:04

0 Answers0