Height issue with TwitterKit iOS tweet

ios
twitterkit

#1

Hi!

We are using TwitterKit 3.2.1 and TwitterCore 3.0.2. It seems that there’s a view height issue with ‘prefilled’ tweet (at least with iOS 11). If text is typed with iOS keyboard the view becomes taller as expected but if we use composer.setText method the tweet box does not expand as needed and not all text is shown. Also scrolling the tweet view does not reveal the hidden text. The actual tweeting functionality works tough as expected, and it gets published in Twitter.

Here’s an example (texts are in Finnish) :

It’s pretty bad that the user cannot see what he/she is tweeting. How can this be fixed?

Probably duplicate of this https://twittercommunity.com/t/composer-doesnt-display-view-correctly/95028


#2

I’m having the exact same issue.

Obj-c and the following versions through Cocoapods:
TwitterCore (3.0.2)
TwitterKit (3.2.1):
TwitterCore (>= 3.0.2)

I’m experiencing this issue when the pre-composed tweet is more than three lines.
The ‘Tweet’ button is not validating correctly when you try to tweet more than 140 characters (still enabled)
When you add or remove characters, this will force a re-layout and a re-validation of the Tweet

Hope this helps!


#3

I am avoiding it as follows.

let viewController = TWTRComposerViewController(initialText: "long text... ", image: nil, videoData: nil)
present(viewController, animated: true) {
    if let textView = viewController.view!.subviews.first!.subviews.first!.subviews.first!.subviews.first!.subviews.first!.subviews.first!.subviews[1].subviews[1] as? UITextView,
        let scrollView = viewController.view!.subviews.first!.subviews.first!.subviews.first!.subviews.first!.subviews.first! as? UIScrollView {
        viewController.view.clipsToBounds = false
        textView.font = UIFont.systemFont(ofSize: 17)
        textView.sizeToFit()
        scrollView.contentSize = textView.frame.size
        scrollView.setNeedsUpdateConstraints()
    }
}

This is not a good method.
It takes time for scrolling to be possible.
Perhaps it will only work with this version.