diff --git a/CHANGELOG.md b/CHANGELOG.md index bc95c3c6..7539df15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,12 @@ The changelog for `MessageKit`. Also see the [releases](https://github.com/Messa ## Upcoming release -### [[Prerelease] 0.13.1](https://github.com/MessageKit/MessageKit/releases/tag/0.13.1) +### Added + +- Added `shouldManageSendButtonEnabledState` to `MessageInputBar` to disable automatically managing `MessageInputBar.sendButton`'s `isEnabled` state when text changes. (Default value is `true`). +[#530](https://github.com/MessageKit/MessageKit/pull/530) by [@clayellis](https://github.com/clayellis). + +## [[Prerelease] 0.13.1](https://github.com/MessageKit/MessageKit/releases/tag/0.13.1) ### Fixed diff --git a/Sources/Views/MessageInputBar.swift b/Sources/Views/MessageInputBar.swift index cbc1dbb4..a75f3480 100644 --- a/Sources/Views/MessageInputBar.swift +++ b/Sources/Views/MessageInputBar.swift @@ -136,6 +136,9 @@ open class MessageInputBar: UIView { $0.messageInputBar?.didSelectSendButton() } }() + + /// A boolean that determines whether the sendButton's `isEnabled` state should be managed automatically. + open var shouldManageSendButtonEnabledState = true /** The anchor constants that inset the contentView @@ -670,7 +673,9 @@ open class MessageInputBar: UIView { open func textViewDidChange() { let trimmedText = inputTextView.text.trimmingCharacters(in: .whitespacesAndNewlines) - sendButton.isEnabled = !trimmedText.isEmpty || inputTextView.images.count > 0 + if shouldManageSendButtonEnabledState { + sendButton.isEnabled = !trimmedText.isEmpty || inputTextView.images.count > 0 + } inputTextView.placeholderLabel.isHidden = !inputTextView.text.isEmpty items.forEach { $0.textViewDidChangeAction(with: inputTextView) }