Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextView's font breaks when you type emoji #838

Closed
phlippieb opened this issue Aug 14, 2017 · 3 comments
Closed

TextView's font breaks when you type emoji #838

phlippieb opened this issue Aug 14, 2017 · 3 comments

Comments

@phlippieb
Copy link
Contributor

When using a TextView, if a user types emoji, the text after the emoji is in a different font. This works fine when using a normal UITextView.

To reproduce the issue, create a single application project with Material, and use this as the ViewController:

import UIKit
import Material

class ViewController: UIViewController {
    let uiTextView: UITextView = {
        let textView = UITextView()
        textView.borderWidth = 1
        return textView
    }()
    
    let mTextView: TextView = {
        let textView = TextView()
        textView.borderWidth = 1
        return textView
    }()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        view.addSubview(uiTextView)
        view.addSubview(mTextView)
    }
    
    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        uiTextView.frame = CGRect(x: 32, y: 32, width: view.bounds.width - 64, height: 100)
        mTextView.frame = CGRect(x: 32, y: 164, width: view.bounds.width - 64, height: 100)
    }
}

As demonstrated in this screenshot, the UITextView (the first box) handles emoji correctly, while the Material TextView (the second box) does not.

screen shot 2017-08-14 at 3 56 44 pm

Slack seems to have the same issue: slackhq/SlackTextViewController#536

I am using XCode 8.3.3, targeting iOS 9 and up (running iOS 10 in screenshot).

@phlippieb
Copy link
Contributor Author

This seems to happen only when a TextView is initialized using the convenience no-parameter init(). Seemingly something about overriding how the layout manager is constructed breaks this. I can bypass the issue by constructing it as TextView(textContainer: nil).

@daniel-jonathan
Copy link
Member

hmmm... I will have to take a look at this. Thank you, it is now in the queue.

@daniel-jonathan
Copy link
Member

This is now fixed in Material 2.16.3. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants