Skip to content

Commit ace9bd2

Browse files
author
Ignacio Romero Zurbuchen
authored
Merge pull request slackhq#488 from yury/bottom-margin-fix
Fix for slk_dismissTextInputbarIfNeeded
2 parents 02963a8 + 633fc08 commit ace9bd2

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Source/SLKTextViewController.m

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,8 @@ - (void)slk_handlePanGestureRecognizer:(UIPanGestureRecognizer *)gesture
933933
// Skips this if it's not the expected textView.
934934
// Checking the keyboard height constant helps to disable the view constraints update on iPad when the keyboard is undocked.
935935
// Checking the keyboard status allows to keep the inputAccessoryView valid when still reacing the bottom of the screen.
936-
if (![self.textView isFirstResponder] || (self.keyboardHC.constant == 0 && self.keyboardStatus == SLKKeyboardStatusDidHide)) {
936+
CGFloat bottomMargin = [self slk_appropriateBottomMargin];
937+
if (![self.textView isFirstResponder] || (self.keyboardHC.constant == bottomMargin && self.keyboardStatus == SLKKeyboardStatusDidHide)) {
937938
#if SLKBottomPanningEnabled
938939
if ([gesture.view isEqual:self.scrollViewProxy]) {
939940
if (gestureVelocity.y > 0) {
@@ -1169,11 +1170,12 @@ - (void)slk_enableTypingSuggestionIfNeeded
11691170

11701171
- (void)slk_dismissTextInputbarIfNeeded
11711172
{
1172-
if (self.keyboardHC.constant == 0) {
1173+
CGFloat bottomMargin = [self slk_appropriateBottomMargin];
1174+
if (self.keyboardHC.constant == bottomMargin) {
11731175
return;
11741176
}
11751177

1176-
self.keyboardHC.constant = 0.0;
1178+
self.keyboardHC.constant = bottomMargin;
11771179
self.scrollViewHC.constant = [self slk_appropriateScrollViewHeight];
11781180

11791181
[self slk_hideAutoCompletionViewIfNeeded];
@@ -1294,8 +1296,9 @@ - (void)didPressEscapeKey:(UIKeyCommand *)keyCommand
12941296
else if (_textInputbar.isEditing) {
12951297
[self didCancelTextEditing:keyCommand];
12961298
}
1297-
1298-
if ([self ignoreTextInputbarAdjustment] || ([self.textView isFirstResponder] && self.keyboardHC.constant == 0)) {
1299+
1300+
CGFloat bottomMargin = [self slk_appropriateBottomMargin];
1301+
if ([self ignoreTextInputbarAdjustment] || ([self.textView isFirstResponder] && self.keyboardHC.constant == bottomMargin)) {
12991302
return;
13001303
}
13011304

0 commit comments

Comments
 (0)