Skip to content

Commit

Permalink
Merge pull request #342 from edx/fix/post-button
Browse files Browse the repository at this point in the history
[iOS] "Post" button is almost invisible in active state for Discussions
  • Loading branch information
rnr authored Mar 19, 2024
2 parents fd3fa4c + 96106dc commit d704613
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Core/Core/View/Base/FlexibleKeyboardInputView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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.accentXColor)
.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)

Expand Down

0 comments on commit d704613

Please sign in to comment.