 
     // MARK: Layout
 
+    override func layoutSubviews() {
+        super.layoutSubviews()
+        updateTextViewHeight()
+    }
+
+    private let maxTextViewHeight: CGFloat = 150
+
     private func setupLayout() {
-        snp.makeConstraints {
-            $0.height.equalTo(44)
-        }
+        translatesAutoresizingMaskIntoConstraints = false
         textView.snp.makeConstraints {
             $0.edges.equalTo(UIEdgeInsets(top: 8, left: 8, bottom: 8, right: 8))
+            $0.height.equalTo(0)
         }
+    }
+
+    fileprivate func updateTextViewHeight() {
+        let computedTextViewHeight = self.computedTextViewHeight
+        if computedTextViewHeight < maxTextViewHeight {
+            textView.snp.updateConstraints {
+                $0.height.equalTo(computedTextViewHeight)
+            }
+            textView.isScrollEnabled = false
+        } else {
+            textView.isScrollEnabled = true
+        }
+    }
+
+    private var computedTextViewHeight: CGFloat {
+        let textViewWidth = textView.frame.size.width
+        let textViewSize = textView.sizeThatFits(CGSize(width: textViewWidth, height: CGFloat.greatestFiniteMagnitude))
+        return textViewSize.height
+    }
+
+}
+
+extension MessagesInputAccessoryView: UITextViewDelegate {
+
+    func textViewDidChange(_ textView: UITextView) {
+        updateTextViewHeight()
     }
 
 }

            textView.layer.borderWidth = 0.5
            textView.layer.borderColor = UIColor.black.cgColor
            textView.layer.cornerRadius = 5
            return textView
        }


        super.init(frame: .zero)
        loadSubviews()
        setupLayout()
        textView.delegate = self
    }

    required init?(coder aDecoder: NSCoder) {
