I am making a list of questions sets and want the whole row to navigate to next view (every row has a different destination view), but only the area next to the text is tappable. I tried creating a SetRow() outside of List and it was working completely fine, but when its inside of List only the empty area is working.
List code here:
NavigationView {
VStack {
SearchBar(input: $searchInput)
List(viewModel.filterList(by: searchInput)) { setVM in
NavigationLink(destination:
SetView(viewModel: QuestionListViewModel(
emoji: setVM.questionSet.emoji,
title: setVM.questionSet.title,
setID: setVM.questionSet.id)
))
{
SetRow(viewModel: setVM)
}
.onLongPressGesture(minimumDuration: 1) {
selectedSetVM = setVM
showDeleteAlert.toggle()
}
}
.listStyle(PlainListStyle())
}
and SetRow code here:
HStack {
Text(viewModel.questionSet.emoji)
.font(.system(size: 50))
VStack(alignment: .leading) {
Text(viewModel.questionSet.title)
.font(.system(size: 20, weight: .semibold, design: .default))
VStack(alignment: .leading) {
Text("Questions: \(viewModel.questionSet.size)")
.font(.system(size: 15, weight: .light, design: .default))
.foregroundColor(.gray)
Text("Updated: \(viewModel.questionSet.lastUpdated, formatter: taskDateFormat)")
.font(.system(size: 15, weight: .light, design: .default))
.foregroundColor(.gray)
}
}
Spacer()
}
.padding(.top, 10)