Skip to content
This repository was archived by the owner on Oct 30, 2018. It is now read-only.

Fix for slk_dismissTextInputbarIfNeeded #488

Merged
merged 1 commit into from
Jul 20, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions Source/SLKTextViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,8 @@ - (void)slk_handlePanGestureRecognizer:(UIPanGestureRecognizer *)gesture
// Skips this if it's not the expected textView.
// Checking the keyboard height constant helps to disable the view constraints update on iPad when the keyboard is undocked.
// Checking the keyboard status allows to keep the inputAccessoryView valid when still reacing the bottom of the screen.
if (![self.textView isFirstResponder] || (self.keyboardHC.constant == 0 && self.keyboardStatus == SLKKeyboardStatusDidHide)) {
CGFloat bottomMargin = [self slk_appropriateBottomMargin];
if (![self.textView isFirstResponder] || (self.keyboardHC.constant == bottomMargin && self.keyboardStatus == SLKKeyboardStatusDidHide)) {
#if SLKBottomPanningEnabled
if ([gesture.view isEqual:self.scrollViewProxy]) {
if (gestureVelocity.y > 0) {
Expand Down Expand Up @@ -1169,11 +1170,12 @@ - (void)slk_enableTypingSuggestionIfNeeded

- (void)slk_dismissTextInputbarIfNeeded
{
if (self.keyboardHC.constant == 0) {
CGFloat bottomMargin = [self slk_appropriateBottomMargin];
if (self.keyboardHC.constant == bottomMargin) {
return;
}

self.keyboardHC.constant = 0.0;
self.keyboardHC.constant = bottomMargin;
self.scrollViewHC.constant = [self slk_appropriateScrollViewHeight];

[self slk_hideAutoCompletionViewIfNeeded];
Expand Down Expand Up @@ -1294,8 +1296,9 @@ - (void)didPressEscapeKey:(UIKeyCommand *)keyCommand
else if (_textInputbar.isEditing) {
[self didCancelTextEditing:keyCommand];
}

if ([self ignoreTextInputbarAdjustment] || ([self.textView isFirstResponder] && self.keyboardHC.constant == 0)) {

CGFloat bottomMargin = [self slk_appropriateBottomMargin];
if ([self ignoreTextInputbarAdjustment] || ([self.textView isFirstResponder] && self.keyboardHC.constant == bottomMargin)) {
return;
}

Expand Down