Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 875fae3

Browse files
author
Ignacio Romero Zurbuchen
committed
Ignores keyboard notifications when no valid responder is detected.
1 parent 6179a17 commit 875fae3

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

Source/SLKTextViewController.m

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,13 +1325,17 @@ - (void)slk_willShowOrHideKeyboard:(NSNotification *)notification
13251325
}
13261326

13271327
UIResponder *currentResponder = [UIResponder slk_currentFirstResponder];
1328-
// Skips this it's not the expected textView and shouldn't force adjustment of the text input bar.
1328+
1329+
// Detects the current first responder. Ignores these notifications when no valid responder is detected.
1330+
if (!currentResponder) {
1331+
return;
1332+
}
1333+
1334+
// Skips if it's not the expected textView and shouldn't force adjustment of the text input bar.
13291335
// This will also dismiss the text input bar if it's visible, and exit auto-completion mode if enabled.
1330-
if (currentResponder && ![currentResponder isEqual:self.textView]) {
1331-
// Detect the current first responder. If there is no first responder, we should just ignore these notifications.
1332-
if (![self forceTextInputbarAdjustmentForResponder:currentResponder]) {
1333-
return [self slk_dismissTextInputbarIfNeeded];
1334-
}
1336+
if (![currentResponder isEqual:self.textView] && ![self forceTextInputbarAdjustmentForResponder:currentResponder]) {
1337+
[self slk_dismissTextInputbarIfNeeded];
1338+
return;
13351339
}
13361340

13371341
SLKKeyboardStatus status = [self slk_keyboardStatusForNotification:notification];

0 commit comments

Comments
 (0)