add limit lines

This commit is contained in:
cheykrym 2025-10-23 18:41:14 +03:00
parent fa1637a5af
commit 2f8c1f3514

View File

@ -8,6 +8,8 @@ struct PrivateChatView: View {
let currentUserId: String? let currentUserId: String?
private let bottomAnchorId = "PrivateChatBottomAnchor" private let bottomAnchorId = "PrivateChatBottomAnchor"
let lineLimitInChat = 6
@StateObject private var viewModel: PrivateChatViewModel @StateObject private var viewModel: PrivateChatViewModel
@State private var hasPositionedToBottom: Bool = false @State private var hasPositionedToBottom: Bool = false
@State private var scrollToBottomTrigger: UUID = .init() @State private var scrollToBottomTrigger: UUID = .init()
@ -247,9 +249,9 @@ struct PrivateChatView: View {
ZStack(alignment: .bottomTrailing) { ZStack(alignment: .bottomTrailing) {
Group { Group {
if #available(iOS 160.0, *) { if #available(iOS 16.0, *) {
TextField(inputTab.placeholder, text: $draftText, axis: .vertical) TextField(inputTab.placeholder, text: $draftText, axis: .vertical)
.lineLimit(1...4) .lineLimit(1...lineLimitInChat)
.focused($isComposerFocused) .focused($isComposerFocused)
.submitLabel(.send) .submitLabel(.send)
.disabled(currentUserId == nil) .disabled(currentUserId == nil)
@ -263,8 +265,8 @@ struct PrivateChatView: View {
set: { isComposerFocused = $0 } set: { isComposerFocused = $0 }
), ),
isEnabled: currentUserId != nil, isEnabled: currentUserId != nil,
minHeight: 40, minHeight: 10,
maxLines: 4, maxLines: lineLimitInChat,
calculatedHeight: $legacyComposerHeight, calculatedHeight: $legacyComposerHeight,
onSubmit: sendCurrentMessage onSubmit: sendCurrentMessage
) )