Reputation: 8687
how can i turn off the button highlighting in SwiftUI, when its tapped or pressed.
Here's my code:
ScrollView {
ForEach(searchManager.resultUsers) { user in
Button(action: {
self.showProfile = true
self.user = user
}) {
SearchUserRow(user: user)
.foregroundColor(.primary)
}
}
}.sheet(isPresented: $showProfile) {
ProfileView(profileUser: self.user)
.environmentObject(ProfileManager(userID: self.user.userID, fetchingMode: .user(mode: .tweets)))
}
if i remove the button and add onTapGesture
to SearchUserRow
not the complete row is selectable, only the content part.
Upvotes: 4
Views: 2105
Reputation: 40489
Try this one, it works for me, but since I don't have the SearchUserRow()
code, I cannot fully try it myself:
SearchUserRow(user: user).foregroundColor(.primary)
.contentShape(Rectangle())
.onTapGesture { ... }
Upvotes: 4