Tap gesture doesn't work
brightfuture opened this issue · comments
for the cells i created,
the tap gesture added to the view doesn't work.
Sorry to hear, but I would need more info / see some code, if you need any help.
Am having this same error too!
GridStack(minCellWidth: 75, spacing:2, numItems: 100) { index, cellWidth in
GridCell(imageUrl:"some image url")
.onTapGesture {
// Any code or method inside here does not get called
}
}
Interesting. Thanks for the report. Not sure I'll have time to look into it too soon.
@toyinswift have you found any solution regarding this ? I am trying to go to another view from an image. But it does not allow me to do this.
Did you try embedding a Button()
with the background image set from the URL? I'm using it this way and it works.
GridStack(minCellWidth: 130, spacing: 10, numItems: storyPointList.count) { index, cellWidth in
Button(action: {
self.showingDetail.toggle()
print("The user has opened the \(storyPointList[index].points) card.")
self.selectedIndex = storyPointList[index].position
}) {
// This is a custom rectangle.
PointCard(storyPoint: storyPointList[index])
.frame(width: cellWidth, height: cellWidth * 0.66)
.foregroundColor(.white)
.background(Color("Purple"))
.cornerRadius(10)
.font(.headline)
}
}
.sheet(isPresented: $showingDetail) {
// If the selected index is the question, then pass the question details.
if self.selectedIndex == 9 {
AlternateQuestionView(storyPoint: storyPointList[9])
} else {
CardView(storyPoint: storyPointList[self.selectedIndex])
}
}
I mean, in this context it works for me.