fix: month title disappears in Liquid Glass mode on month change

The glass variant rendered the month title in a `.principal` ToolbarItem, which
SwiftUI drops when the state it reads (visibleMonth) changes while on screen —
it only reappeared on an unrelated rebuild (opening/closing the menu) and
vanished again on the next month change. Switched to `.navigationTitle`, which
the system updates reliably.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Scarriffle
2026-06-01 08:50:32 +02:00
parent a62b200dfa
commit 852e46fcf8

View File

@@ -112,6 +112,12 @@ struct CalendarHostView: View {
.overlay(alignment: .top) { .overlay(alignment: .top) {
if let err = store.lastError { errorBannerView(err).padding(.top, 8) } if let err = store.lastError { errorBannerView(err).padding(.top, 8) }
} }
// The month title uses `.navigationTitle` rather than a
// `.principal` ToolbarItem: a principal item disappears when the
// state it reads (visibleMonth) changes while on screen (month
// change / scroll), reappearing only on an unrelated rebuild.
// navigationTitle is updated reliably by the system.
.navigationTitle(titleString)
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
.toolbar { .toolbar {
ToolbarItem(placement: .navigationBarLeading) { ToolbarItem(placement: .navigationBarLeading) {
@@ -121,12 +127,6 @@ struct CalendarHostView: View {
Button(L10n.t("nav.today", appLang)) { store.moveToToday() }.font(.callout) Button(L10n.t("nav.today", appLang)) { store.moveToToday() }.font(.callout)
} }
} }
ToolbarItem(placement: .principal) {
Text(titleString)
.font(.headline)
.lineLimit(1)
.minimumScaleFactor(0.7)
}
ToolbarItem(placement: .navigationBarTrailing) { ToolbarItem(placement: .navigationBarTrailing) {
HStack(spacing: 8) { HStack(spacing: 8) {
if !groups.isEmpty { groupMenu } if !groups.isEmpty { groupMenu }