LazyVStack NavigationLink is not clickable

Viewed 305

I have a LazyVStack

                        ScrollView {
                            if #available(iOS 14.0, *) {
                                LazyVStack {
                                    ForEach(searchViewModel.allUsers, id: \.uid) { user in
                                        VStack {
                                            profileCard(profileURL: user.profileURL, username: user.username, age: user.age, cardWidth: self.cardWidth, country: user.city)
                                            NavigationLink(destination: ProfileDetailedView(userData: user)) {
                                                EmptyView()
                                            }.buttonStyle(PlainButtonStyle())
                                        }.padding(.top,5)
                                    }
                                }
                            } else {
                                // Fallback on earlier versions
                            }
                        }

And now the NavigationLink is not working?

My Original code without LazyVStack worked fine (below)

                       List {
                            ForEach(searchViewModel.allUsers, id: \.uid) { user in
                                VStack {
                                    profileCard(profileURL: user.profileURL, username: user.username, age: user.age, cardWidth: self.cardWidth, country: user.city)
                                    NavigationLink(destination: ProfileDetailedView(userData: user)) {
                                        EmptyView()
                                    }.buttonStyle(PlainButtonStyle())
                                }.padding(.top,5)
                            }
                        }

Update

I am using NavigationView at the top of the view

0 Answers
Related