Mert Köksal
Mert Köksal

Reputation: 901

.sheet .ontapgesture on scrollview not working swiftui

Unfortunately, it does not work. When I tap one of the cells it does not do anything. My .sheet is outside of 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)})

Upvotes: 0

Views: 130

Answers (1)

Mert Köksal
Mert Köksal

Reputation: 901

Because I had another .onTapGesture inside the AuthorListElement. When I deleted the one in the AuthorListElement it works.

Upvotes: 1

Related Questions