mirror of
https://github.com/yattee/yattee.git
synced 2024-12-23 14:03:41 +00:00
Add disable for multiselect row
This commit is contained in:
parent
601523ab1b
commit
c23b42f76c
@ -2,7 +2,8 @@ import SwiftUI
|
||||
|
||||
struct MultiselectRow: View {
|
||||
let title: String
|
||||
let selected: Bool
|
||||
var selected: Bool
|
||||
var disabled = false
|
||||
var action: (Bool) -> Void
|
||||
|
||||
@State private var toggleChecked = false
|
||||
@ -16,6 +17,7 @@ struct MultiselectRow: View {
|
||||
Spacer()
|
||||
}
|
||||
.onAppear {
|
||||
guard !disabled else { return }
|
||||
toggleChecked = selected
|
||||
}
|
||||
.onChange(of: toggleChecked) { new in
|
||||
@ -34,6 +36,7 @@ struct MultiselectRow: View {
|
||||
}
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
.disabled(disabled)
|
||||
#if !os(tvOS)
|
||||
.buttonStyle(.plain)
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user