fix: remove weird animation on game selection

Disables implicit animation when toggling game selection to prevent
visual glitches/morphing effect. Uses both withTransaction to disable
animations on the state change and .animation(nil, value:) on the
selection indicator and row background.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-01-12 18:41:40 -06:00
parent 7946161945
commit d255e28dcc

View File

@@ -1252,10 +1252,15 @@ struct TeamSection: View {
game: game,
isSelected: selectedIds.contains(game.id),
onTap: {
if selectedIds.contains(game.id) {
selectedIds.remove(game.id)
} else {
selectedIds.insert(game.id)
// Disable implicit animation to prevent weird morphing effect
var transaction = Transaction()
transaction.disablesAnimations = true
withTransaction(transaction) {
if selectedIds.contains(game.id) {
selectedIds.remove(game.id)
} else {
selectedIds.insert(game.id)
}
}
}
)
@@ -1286,6 +1291,7 @@ struct GameCalendarRow: View {
Image(systemName: isSelected ? "checkmark.circle.fill" : "circle")
.font(.title3)
.foregroundStyle(isSelected ? Theme.warmOrange : Theme.textMuted(colorScheme))
.animation(nil, value: isSelected)
VStack(alignment: .leading, spacing: 2) {
Text("vs \(game.awayTeam.name)")
@@ -1312,6 +1318,7 @@ struct GameCalendarRow: View {
.padding(.vertical, Theme.Spacing.sm)
.padding(.horizontal, Theme.Spacing.md)
.background(isSelected ? Theme.warmOrange.opacity(0.1) : Color.clear)
.animation(nil, value: isSelected)
}
.buttonStyle(.plain)
}