Skip to content

Commit a62639f

Browse files
committed
Make chat table scroll up when text input height changes for uninverted table
1 parent 28c015e commit a62639f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Source/SLKTextViewController.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ - (void)textDidUpdate:(BOOL)animated
664664

665665
if (inputbarHeight != self.textInputbarHC.constant)
666666
{
667+
CGFloat inputBarHeightDelta = inputbarHeight - self.textInputbarHC.constant;
667668
self.textInputbarHC.constant = inputbarHeight;
668669
self.scrollViewHC.constant = [self slk_appropriateScrollViewHeight];
669670

@@ -676,8 +677,12 @@ - (void)textDidUpdate:(BOOL)animated
676677
[self.view slk_animateLayoutIfNeededWithBounce:bounces
677678
options:UIViewAnimationOptionCurveEaseInOut|UIViewAnimationOptionLayoutSubviews|UIViewAnimationOptionBeginFromCurrentState
678679
animations:^{
680+
if (!self.isInverted) {
681+
self.scrollViewProxy.contentOffset = CGPointMake(0, self.scrollViewProxy.contentOffset.y + inputBarHeightDelta);
682+
}
679683
if (weakSelf.textInputbar.isEditing) {
680684
[weakSelf.textView slk_scrollToCaretPositonAnimated:NO];
685+
681686
}
682687
}];
683688
}

0 commit comments

Comments
 (0)