I am trying to make a Log Out button inside a List with sections. However, when I add the button to the section, only the "Log Out" text is clickable and not the entire section. I don't want to resize it to anything larger than the current section its in.
I have searched online for a similar question, but all of those involve making two things clickable in one section, not the row itself.
Section{
//Log out button
Button("Log Out"){
signOutAlert = true
}
.foregroundColor(.red)
.buttonStyle(.borderless)
.alert(isPresented: $signOutAlert){
Alert(
title: Text("Log Out"),
message: Text("Are you sure you want to log out?"),
primaryButton: .destructive(Text("Log Out")){
do {
try Auth.auth().signOut()
auth_status.current_status = .unauthenticated
} catch let signOutError as NSError {
print("Error logging out")
}
},
secondaryButton: .cancel()
)
}
}
Unlike creating a Navigation or Link, the entire thing isn't clickable. Is there another way I can keep my log out functionality?
EDIT: As @flanker pointed out. My issue was having .buttonStyle(.borderless)
Removing it resulted in my intended output