From 90d0a03eab3994934c6c8a33c6e09a1809897a14 Mon Sep 17 00:00:00 2001 From: kutesir Date: Fri, 29 May 2026 11:18:56 +0300 Subject: [PATCH] Fix add-task sheet expanding to full screen on keyboard iOS auto-snaps to the next larger detent when keyboard appears over a text field. Removing .large locks the sheet to .height(150) so it stays compact and hugs the keyboard like the reference app. Also removed the Description label and reduced input maxHeight to 72pt so all content fits within the 150pt detent. --- KisaniCal/Views/CalendarView.swift | 2 +- KisaniCal/Views/MatrixView.swift | 2 +- KisaniCal/Views/TodayView.swift | 28 +++++++++++----------------- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/KisaniCal/Views/CalendarView.swift b/KisaniCal/Views/CalendarView.swift index 08d9aa7..992e529 100644 --- a/KisaniCal/Views/CalendarView.swift +++ b/KisaniCal/Views/CalendarView.swift @@ -186,7 +186,7 @@ struct CalendarView: View { .sheet(isPresented: $showAddTask) { AddTaskSheet(prefilledDate: selectedDate) .environmentObject(taskVM) - .presentationDetents([.height(150), .large]) + .presentationDetents([.height(150)]) .presentationDragIndicator(.visible) } .sheet(isPresented: $showCalendarConnect) { diff --git a/KisaniCal/Views/MatrixView.swift b/KisaniCal/Views/MatrixView.swift index 0a6f5e6..89ac46c 100644 --- a/KisaniCal/Views/MatrixView.swift +++ b/KisaniCal/Views/MatrixView.swift @@ -67,7 +67,7 @@ struct MatrixView: View { .sheet(isPresented: $showAddTask) { AddTaskSheet() .environmentObject(taskVM) - .presentationDetents([.height(150), .large]) + .presentationDetents([.height(150)]) .presentationDragIndicator(.visible) } } diff --git a/KisaniCal/Views/TodayView.swift b/KisaniCal/Views/TodayView.swift index 30af472..20104b4 100644 --- a/KisaniCal/Views/TodayView.swift +++ b/KisaniCal/Views/TodayView.swift @@ -188,7 +188,7 @@ struct TodayView: View { .sheet(isPresented: $showAddTask) { AddTaskSheet() .environmentObject(taskVM) - .presentationDetents([.height(150), .large]) + .presentationDetents([.height(150)]) .presentationDragIndicator(.visible) } .sheet(isPresented: $showWorkoutSession) { @@ -982,24 +982,18 @@ struct AddTaskSheet: View { var body: some View { VStack(spacing: 0) { // ── Text input ────────────────────────────────────────────────── - VStack(alignment: .leading, spacing: 8) { - NLTaskField( - text: $rawText, - placeholder: "What would you like to do?", - highlightRanges: parsed.tokenRanges - ) - .frame(minHeight: 32, maxHeight: 120) - .onChange(of: rawText) { _ in - withAnimation(KisaniSpring.micro) { parsed = NLTaskParser.parse(rawText) } - } - - Text("Description") - .font(AppFonts.sans(15)) - .foregroundColor(AppColors.text3(cs)) + NLTaskField( + text: $rawText, + placeholder: "What would you like to do?", + highlightRanges: parsed.tokenRanges + ) + .frame(minHeight: 36, maxHeight: 72) + .onChange(of: rawText) { _ in + withAnimation(KisaniSpring.micro) { parsed = NLTaskParser.parse(rawText) } } .padding(.horizontal, 16) - .padding(.top, 16) - .padding(.bottom, 12) + .padding(.top, 14) + .padding(.bottom, 10) // ── Toolbar ───────────────────────────────────────────────────── Divider().background(AppColors.border(cs))