Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

Fix #648: Verify that inputToolbar isFirstResponder before responding to UIKeyboard notifications #649

Closed
wants to merge 2 commits into from

Conversation

toblerpwn
Copy link
Contributor

This PR fixes #648 by checking verifying that the inputToolbar textView isFirstResponder - OR whether it is already 'in motion', i.e. in the process of being hidden AFTER it resignFirstResponder is called.

NOTE: The changes introduced in #646 will also need this fix - i.e. the same conditional must be applied to the 'keyboard did hide' notification handler.

:: JSQMessagesViewController now ignores keyboard frame changes unless the input toolbar `isFirstResponder`
:: frame changes are still observed and broadcast, but no action is taken in the controller
:: fixes jessesquires#648
:: if inputToolbar is in-motion (i.e. when toolbarBottomLayoutGuide != 0), react to frame change notifications
:: this allows the inputToolbar to slide gracefully after it calls `resignFirstResponder`
:: this is especially important after jessesquires#646 (or similar explicit handling of the 'keyboard did hide' event) is implemented
@jessesquires jessesquires added this to the Release 6.1.1 milestone Nov 27, 2014
heightFromBottom = MAX(0.0f, heightFromBottom);

[self jsq_setToolbarBottomLayoutGuideConstant:heightFromBottom];
if ([self.inputToolbar.contentView.textView isFirstResponder] || self.toolbarBottomLayoutGuide.constant != 0) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @toblerpwn - aren't these 2 conditions mutually inclusive?

that is, if we are the firstResponder, then the layoutGuide will be non-zero.

likewise, if the layoutGuide is non-zero, then we are not the first responder.

@jessesquires
Copy link
Owner

thanks @toblerpwn - one question for you above.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Input toolbar 'follows' keyboard even when it is not first responder
2 participants