Skip to content

Commit

Permalink
Fix TPKeyboardAvoiding_contentInsetForKeyboard
Browse files Browse the repository at this point in the history
Reset newInset.bottom to state.priorInset.bottom if they keyboard is getting closed.
  • Loading branch information
agusguerra10 authored and michaeltyson committed Jun 5, 2020
1 parent 08ad91e commit b389815
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,13 @@ - (UIEdgeInsets)TPKeyboardAvoiding_contentInsetForKeyboard {
TPKeyboardAvoidingState *state = self.keyboardAvoidingState;
UIEdgeInsets newInset = self.contentInset;
CGRect keyboardRect = state.keyboardRect;
newInset.bottom = keyboardRect.size.height - MAX((CGRectGetMaxY(keyboardRect) - CGRectGetMaxY(self.bounds)), 0);

if (keyboardRect.size.height == 0) {
newInset.bottom = state.priorInset.bottom;
} else {
newInset.bottom = keyboardRect.size.height - MAX((CGRectGetMaxY(keyboardRect) - CGRectGetMaxY(self.bounds)), 0);
}

return newInset;
}

Expand Down

0 comments on commit b389815

Please sign in to comment.