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 #512 from slackhq/storeKeyboardHeightEarlier
Browse files Browse the repository at this point in the history
Store keyboard height earlier
  • Loading branch information
ZAndyL authored Sep 16, 2016
2 parents 4b0ce38 + 86da137 commit 7ea387a
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions Source/SLKTextViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1352,29 +1352,28 @@ - (void)slk_willShowOrHideKeyboard:(NSNotification *)notification
return;
}

// Updates and notifies about the keyboard status update
if ([self slk_updateKeyboardStatus:status]) {
// Posts custom keyboard notification, if logical conditions apply
[self slk_postKeyboarStatusNotification:notification];
}

// Programatically stops scrolling before updating the view constraints (to avoid scrolling glitch).
if (status == SLKKeyboardStatusWillShow) {
[self.scrollViewProxy slk_stopScrolling];
}

// Hides the auto-completion view if the keyboard is being dismissed.
if (![self.textView isFirstResponder] || status == SLKKeyboardStatusWillHide) {
[self slk_hideAutoCompletionViewIfNeeded];
}

// Stores the previous keyboard height
CGFloat previousKeyboardHeight = self.keyboardHC.constant;

// Updates the height constraints' constants
self.keyboardHC.constant = [self slk_appropriateKeyboardHeightFromNotification:notification];
self.scrollViewHC.constant = [self slk_appropriateScrollViewHeight];

// Updates and notifies about the keyboard status update
if ([self slk_updateKeyboardStatus:status]) {
// Posts custom keyboard notification, if logical conditions apply
[self slk_postKeyboarStatusNotification:notification];
}

// Hides the auto-completion view if the keyboard is being dismissed.
if (![self.textView isFirstResponder] || status == SLKKeyboardStatusWillHide) {
[self slk_hideAutoCompletionViewIfNeeded];
}

NSInteger curve = [notification.userInfo[UIKeyboardAnimationCurveUserInfoKey] integerValue];
NSTimeInterval duration = [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue];
Expand Down

0 comments on commit 7ea387a

Please sign in to comment.