mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Fix text view placeholder bug
This commit is contained in:
parent
b2c6a5229b
commit
bc91d9ef0c
|
@ -3,6 +3,8 @@ public final class InputTextView : UITextView, UITextViewDelegate {
|
||||||
private let snDelegate: InputTextViewDelegate
|
private let snDelegate: InputTextViewDelegate
|
||||||
private lazy var heightConstraint = self.set(.height, to: minHeight)
|
private lazy var heightConstraint = self.set(.height, to: minHeight)
|
||||||
|
|
||||||
|
public override var text: String! { didSet { handleTextChanged() } }
|
||||||
|
|
||||||
// MARK: UI Components
|
// MARK: UI Components
|
||||||
private lazy var placeholderLabel: UILabel = {
|
private lazy var placeholderLabel: UILabel = {
|
||||||
let result = UILabel()
|
let result = UILabel()
|
||||||
|
@ -52,6 +54,10 @@ public final class InputTextView : UITextView, UITextViewDelegate {
|
||||||
|
|
||||||
// MARK: Updating
|
// MARK: Updating
|
||||||
public func textViewDidChange(_ textView: UITextView) {
|
public func textViewDidChange(_ textView: UITextView) {
|
||||||
|
handleTextChanged()
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleTextChanged() {
|
||||||
defer { snDelegate.inputTextViewDidChangeContent(self) }
|
defer { snDelegate.inputTextViewDidChangeContent(self) }
|
||||||
placeholderLabel.isHidden = !text.isEmpty
|
placeholderLabel.isHidden = !text.isEmpty
|
||||||
let width = frame.width
|
let width = frame.width
|
||||||
|
|
Loading…
Reference in a new issue