mirror of
https://github.com/MessageKit/MessageKit.git
synced 2026-02-06 19:03:19 +00:00
Merge pull request #530 from clayellis/feature/auto-update-send
Add boolean flag to disable auto updating send button enabled state
This commit is contained in:
+6
-1
@@ -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
|
||||
|
||||
|
||||
@@ -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) }
|
||||
|
||||
Reference in New Issue
Block a user