Skip to content

Commit e4b30b9

Browse files
committed
Update SirioFiltriChips.swift
1 parent b5915be commit e4b30b9

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Sources/SirioKitIOS/Component/Filtri/View/SirioFiltriChips.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ public struct SirioFiltriChips: View {
3737
HStack {
3838
OverflowLayout() {
3939
ForEach(texts, id: \.self) { text in
40-
SirioChipsSelection(text: text, isSelected: .constant(text == selectedType), isDisabled: $isDisabled, accessibilityLabel: accessibilityLabel)
40+
SirioChipsSelection(text: text, isSelected: Binding(
41+
get: { selectedType == text },
42+
set: { newValue in
43+
selectedType = newValue ? text : nil
44+
}
45+
), isDisabled: $isDisabled, accessibilityLabel: accessibilityLabel)
4146
.padding(.vertical, Size.Filtri.paddingVerticalChips)
4247
}
4348
}
@@ -58,7 +63,12 @@ public struct SirioFiltriChips: View {
5863
ScrollView(.horizontal, showsIndicators: false, content: {
5964
HStack {
6065
ForEach(texts, id: \.self) { text in
61-
SirioChipsSelection(text: text, isSelected: .constant(text == selectedType), isDisabled: $isDisabled, accessibilityLabel: accessibilityLabel)
66+
SirioChipsSelection(text: text, isSelected: Binding(
67+
get: { selectedType == text },
68+
set: { newValue in
69+
selectedType = newValue ? text : nil
70+
}
71+
), isDisabled: $isDisabled, accessibilityLabel: accessibilityLabel)
6272
.padding(.vertical, Size.Filtri.paddingVerticalChips)
6373
}
6474
}

0 commit comments

Comments
 (0)