SwiftUI List Blink when appears List on the screen?

Viewed 807

I have create two screen, first screen have a Button and second screen having a List.

When I click on “EmployeDetail” button using navigationLink it will navigate on List Screen.

When it navigate first time list blink slightly. When I back on first screen and again navigate on the second screen so it will slightly move up side.

I download demo source code from medium blogs, over the demo also having same list blinking Problem, A blinking happens on all the list screen in the Project.

How can I stop a blinking of list on the second screen. also add gif below.

struct Employe: View{

    var body: some View {

        NavigationView {
            NavigationLink(destination: EmployeDetails()) {
                Text("EmployeeDetails")
            }
            .navigationBarTitle("Employee")
        }
    }
}

//List Implement In EmployeeDetails View

struct Employee {
  let name: String
  let type: String
  let indentity: Color
}


struct EmployeDetails: View {

        var employeList = [ Employee(name: "Vinay", type: "Permanent", indentity: .red),
                            Employee(name: "Ashu", type: "Temp", indentity: .blue),
                            Employee(name: "Vishwa", type: "Secure", indentity: .pink),
                            Employee(name: "Mia", type: "Ex", indentity: .orange)
    ]

        var body: some View {
          List(employeList, id: \.name) { employe in
            HStack {
              Text(employe.name)
                Text(employe.type).foregroundColor(employe.indentity)
            }
          }
        .navigationBarTitle("EmployeeDetails")
        }
}

enter image description here

0 Answers
Related