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

Commit

Permalink
Merge pull request #488 from yury/bottom-margin-fix
Browse files Browse the repository at this point in the history
Fix for slk_dismissTextInputbarIfNeeded
  • Loading branch information
Ignacio Romero Zurbuchen authored Jul 20, 2016
2 parents 02963a8 + 633fc08 commit ace9bd2
Showing 1 changed file with 8 additions and 5 deletions.
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

0 comments on commit ace9bd2

Please sign in to comment.