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

textInputbar stays at the bottom after dismissing a UIAlertController while it's the first responder #502

Closed rickrets closed 8 years ago

rickrets commented 8 years ago

Quick steps to reproduce:

dzenbot commented 8 years ago

After tapping on "Cancel" or "Undo", the text view becomes first responder again and the keyboard shows up, right?

rickrets commented 8 years ago

The keyboard shows up yeah, but the text input bar won't move with it.

dzenbot commented 8 years ago

Which version are you using? iOS version?

rickrets commented 8 years ago

1.9.4 using pods, iOS 9.3 with the simulator and the latest iOS version on iPhone 6 and iPhone 6 Plus.

rickrets commented 8 years ago

After pressing Cancel or Undo the code ends up here:

// Skips if it's not the expected textView and shouldn't force adjustment of the text input bar.
// This will also dismiss the text input bar if it's visible, and exit auto-completion mode if enabled.
if (![currentResponder isEqual:self.textView] && ![self forceTextInputbarAdjustmentForResponder:currentResponder]) {
    [self slk_dismissTextInputbarIfNeeded];
    return;
}

The currentResponder is a UIAlertController, so my guess is that I can fix it by overriding forceTextInputbarAdjustmentForResponder:currentResponder and return YES if it's a UIAlertController, but it seems wrong.

dzenbot commented 8 years ago

Unfortunately, that's the way of doing it. Here is how it's done in the sample project: https://github.com/slackhq/SlackTextViewController/blob/master/Examples/Messenger-Shared/MessageViewController.m#L366-L374

rickrets commented 8 years ago

Jeez, how did I miss that. Thank you!