如何解决.sheet .ontapgesture 在滚动视图上不起作用 swiftui
不幸的是,它不起作用。当我点击其中一个单元格时,它什么也不做。我的 .sheet
在 ScrollView
ScrollView(.vertical,showsIndicators: true) {
VStack(spacing: 0) {
ForEach(service.authorPost,id: \.author_id) { post in
AuthorListElementView(authorPost: post)
.onTapGesture {
self.shown.toggle()
self.selectedAuthor = post
}
.onAppear {
self.service.loadMoreContentIfNeeded(currentItem: post)
}
}
}
if service.isLoadingPage {
ProgressView()
.padding()
.offset(x: UIScreen.main.bounds.width / 3)
}
}
.sheet(isPresented: self.$shown,content: { PopupAuthorView(authorPost: selectedAuthor)})
解决方法
因为我在 AuthorListElement 中有另一个 .onTapGesture。当我删除 AuthorListElement 中的那个时,它起作用了。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。