slackhq / SlackTextViewController

⛔️**DEPRECATED** ⛔️ A drop-in UIViewController subclass with a growing text input view and other useful messaging features
https://slack.com/
MIT License
8.32k stars 1.08k forks source link

Keyboard return to alphabet each time #418

Closed novinfard closed 8 years ago

novinfard commented 8 years ago

After clicking on number section on keyboard and then press a number (eg. 1,2,3,...) , it returns to alphabet part each time and it doesn't remain in "number section".

ezgif-2783581416

dzenbot commented 8 years ago

I just tried to repro, and couldn't. What version of the lib are you using? Do you have any auto-completion setup?

novinfard commented 8 years ago

How to disable auto-completion fully to test it? I could find only getter method for it. version 1.9.1

Plus, this warning could be seen in console: Can't find keyplane that supports type 10 for keyboard iPhone-Portrait-Emoji; using 3444608646_Portrait_iPhone-Emoji-Keyboard_Letters

UPDATE: I installed the previous version (1.9.0) and problem completely solved. Then I tested all file of project ,one by one, and found that the problem is definitely in one of the following files of the project: SLKTextViewController.m SLKTextView.h

UPDATE 2: I finally find the bug: SLKTextView.m

- (void)setTypingSuggestionEnabled:(BOOL)enabled {
    if (self.isTypingSuggestionEnabled == enabled) {
        return;
    }

    self.autocorrectionType = enabled ? UITextAutocorrectionTypeDefault : UITextAutocorrectionTypeNo;
    self.spellCheckingType = enabled ? UITextSpellCheckingTypeDefault : UITextSpellCheckingTypeNo;

    [self refreshFirstResponder];
}

By commenting [self refreshFirstResponder] the problem solved.

dzenbot commented 8 years ago

Auto-complete features are disabled by default, unless you register prefixes. https://github.com/slackhq/SlackTextViewController#1-registration

refreshFirstResponder is needed so we can disable the auto-correction while auto-completing, because it overrides unrecognised text all the time when tapping on the space bar.

Try setting self.textView.autocorrectionType = UITextAutocorrectionTypeNo, so it doesn't even try to reload the input view.