From 185bf4f70d034d8f4c8e526f01103ad121209660 Mon Sep 17 00:00:00 2001 From: forgotvas Date: Wed, 13 Mar 2024 17:44:56 +0300 Subject: [PATCH] fix: "Post" button is almost invisible [iOS] "Post" button is almost invisible in active state for Discussions #328 --- .../View/Base/FlexibleKeyboardInputView.swift | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Core/Core/View/Base/FlexibleKeyboardInputView.swift b/Core/Core/View/Base/FlexibleKeyboardInputView.swift index a9625d117..1da57a992 100644 --- a/Core/Core/View/Base/FlexibleKeyboardInputView.swift +++ b/Core/Core/View/Base/FlexibleKeyboardInputView.swift @@ -24,6 +24,10 @@ public struct FlexibleKeyboardInputView: View { self.sendText = sendText } + private var canSend: Bool { + commentText.trimmingCharacters(in: .whitespacesAndNewlines).count > 0 + } + public var body: some View { VStack { VStack { @@ -71,19 +75,22 @@ public struct FlexibleKeyboardInputView: View { ) ).padding(8) Button(action: { - if commentText.trimmingCharacters(in: .whitespacesAndNewlines).count > 0 { + if canSend { sendText(commentText) self.commentText = "" } }, label: { VStack { - commentText.trimmingCharacters(in: .whitespacesAndNewlines).count > 0 - ? CoreAssets.send.swiftUIImage - : CoreAssets.sendDisabled.swiftUIImage + CoreAssets.send.swiftUIImage + .renderingMode(.template) + .foregroundStyle(Theme.Colors.accentColor) + .opacity(canSend ? 1 : 0.5) } .frame(width: 36, height: 36) .foregroundColor(Theme.Colors.white) - }).padding(.top, 8) + }) + .padding(.top, 8) + .disabled(!canSend) }.padding(.horizontal, isHorizontal ? 50 : 16)