         self.addSubview(self.placeholder)
 
         if !wasAttachedBeforeShowing {
+            self.updateBoundsToFitSize()
             self.placeholderDelegate?.expandableTextViewDidShowPlaceholder(self)
         }
     }

        }
    }

    override open func layoutSubviews() {
        super.layoutSubviews()
        self.placeholder.frame = self.bounds
    }

    override open var intrinsicContentSize: CGSize {
        return self.contentSize
    }

    override open var text: String! {

    // MARK: - Private methods

    private func updateBoundsToFitSize() {
        self.bounds.size = self.sizeThatFits(self.bounds.size)
    }
    
    private func updateBoundsToFitSizeForIOS13() {
        guard #available(iOS 13.0, *) else { return }
        /*
         Since iOS 13 Beta 4, changing a text doesn't cause a recalculation of the content size.
         Because of this, invalidateIntrinsicContentSize is not called, and layout is not updated.
         To fix it, updateBoundsToFitSize should be called on each text change.
         
         Analyzing a stack trace:
         -[_UITextContainerView setConstrainedFrameSize:] is still called.
         -[_UITextContainerView setFrame:] is NOT called since iOS 13 Beta 4.
         */
        self.updateBoundsToFitSize()
    }

    private func scrollToCaret() {
