Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ public struct DescriptionBlockEditor: View {
let itemIndex: Int
}

public init(blocks: Binding<[DescriptionBlock]>, characterLimit: Int = 500) {
public init(
blocks: Binding<[DescriptionBlock]>,
characterLimit: Int = 500
) {
self._blocks = blocks
self.characterLimit = characterLimit
}
Expand Down
17 changes: 14 additions & 3 deletions Projects/Shared/Sources/UI/Components/StepSheetContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public struct StepSheetContainer<

@State private var isDismissPressed = false
@State private var isKeyboardPresented = false
@State private var keyboardHeight: CGFloat = 0

public init(
title: String,
Expand Down Expand Up @@ -89,6 +90,7 @@ public struct StepSheetContainer<
let duration = notification.userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? Double ?? 0.25
withAnimation(.easeInOut(duration: duration)) {
isKeyboardPresented = false
keyboardHeight = 0
}
}
}
Expand Down Expand Up @@ -148,7 +150,10 @@ public struct StepSheetContainer<

@ViewBuilder
private var bottomFixedArea: some View {
if !isKeyboardPresented {
if isKeyboardPresented {
Color.clear
.frame(height: keyboardHeight)
} else {
VStack(spacing: 12) {
floatingContent()
.padding(.horizontal, 16)
Expand Down Expand Up @@ -180,7 +185,10 @@ public struct StepSheetContainer<

guard let endFrame = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect else {
if isKeyboardPresented {
withAnimation(.easeInOut(duration: duration)) { isKeyboardPresented = false }
withAnimation(.easeInOut(duration: duration)) {
isKeyboardPresented = false
keyboardHeight = 0
}
}
return
}
Expand All @@ -189,9 +197,12 @@ public struct StepSheetContainer<
.compactMap { $0 as? UIWindowScene }
.first?.screen.bounds.height ?? endFrame.height
let isVisible = endFrame.minY < screenHeight
if isKeyboardPresented != isVisible {
let newHeight = isVisible ? max(0, screenHeight - endFrame.minY) : 0

if isKeyboardPresented != isVisible || keyboardHeight != newHeight {
withAnimation(.easeInOut(duration: duration)) {
isKeyboardPresented = isVisible
keyboardHeight = newHeight
}
}
}
Expand Down
Loading