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 #532 from slackhq/inputHeightScroll
Browse files Browse the repository at this point in the history
Scroll up chat when text input height changes when uninverted
  • Loading branch information
ZAndyL authored Oct 17, 2016
2 parents 28c015e + 04c2059 commit 0bd5b6f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Source/SLKTextViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ - (void)textDidUpdate:(BOOL)animated

if (inputbarHeight != self.textInputbarHC.constant)
{
CGFloat inputBarHeightDelta = inputbarHeight - self.textInputbarHC.constant;
self.textInputbarHC.constant = inputbarHeight;
self.scrollViewHC.constant = [self slk_appropriateScrollViewHeight];

Expand All @@ -676,6 +677,9 @@ - (void)textDidUpdate:(BOOL)animated
[self.view slk_animateLayoutIfNeededWithBounce:bounces
options:UIViewAnimationOptionCurveEaseInOut|UIViewAnimationOptionLayoutSubviews|UIViewAnimationOptionBeginFromCurrentState
animations:^{
if (!self.isInverted) {
self.scrollViewProxy.contentOffset = CGPointMake(0, self.scrollViewProxy.contentOffset.y + inputBarHeightDelta);
}
if (weakSelf.textInputbar.isEditing) {
[weakSelf.textView slk_scrollToCaretPositonAnimated:NO];
}
Expand Down

0 comments on commit 0bd5b6f

Please sign in to comment.