我有以下NavigationLink:
NavigationLink(destination:
TrendSlider(
title: .constant(title),
col: .constant(self.dataModel.queryColumnSeasonWinPercentageTeam1),
opIndx: self.$dataModel.seasonWinPercentageTeam1OperatorIndxValue,
val: self.$dataModel.seasonWinPercentageTeam1SliderValue,
lBound: .constant(self.dataModel.seasonWinPercentageTeam1Values.first!) ,
uBound: .constant(self.dataModel.seasonWinPercentageTeam1Values.last!),
lRange: self.$dataModel.seasonWinPercentageTeam1RangeSliderLowerValue ,
uRange: self.$dataModel.seasonWinPercentageTeam1RangeSliderUpperValue,
step: .constant(1.0),
displayReadableQuery: $readableQuery
)) {
HStack {
if readableQuery.hasSuffix("IS ANY") {
Text(title)
Spacer()
Text("IS ANY").foregroundColor(Color("TPLightGrey"))
}else{
Text(readableQuery).foregroundColor(Color("TPOrange"))
}
}
}.simultaneousGesture(TapGesture().onEnded{
sendViewSelectionEvent(name: self.title, referral: "Game")
})如果我在".simultaneousGesture...“中离开,那么点击文本元素不会触发NavigationLink操作,但是行的其余部分可以工作。
如果删除.simultaneousGesture,则可以再次在任何位置点击该行。
虫子?
发布于 2019-11-05 23:39:24
谢谢你的解释。这不足为奇。这促使我寻找一种合适的方式来触发我的呼叫。
.onAppear(){ .... }我试图在navlink上模拟一个viewWillAppear类型的事件。我把onAppear放在vStack上,它工作得很好。
https://stackoverflow.com/questions/58701514
复制相似问题