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

The keyboard drag location doesn't work for non-full screen chats #1161

Closed
kostub opened this issue Aug 14, 2015 · 1 comment
Closed

The keyboard drag location doesn't work for non-full screen chats #1161

kostub opened this issue Aug 14, 2015 · 1 comment
Labels
Milestone

Comments

@kostub
Copy link

kostub commented Aug 14, 2015

In JSQMessagesKeyboardController.m function

- (void)jsq_handlePanGestureRecognizer:(UIPanGestureRecognizer *)pan

which recognizes keyboard drags calculates whether to dismiss the keyboard as follows:

CGFloat dragThresholdY = (contextViewWindowHeight - keyboardViewHeight - self.keyboardTriggerPoint.y);
BOOL userIsDraggingNearThresholdForDismissing = (touch.y > dragThresholdY);

However this doesn't work if the chat view is not full screen. The issue seems to be that dragThresholdY is calculated in window coordinates while touch is calculated in the co-ordinates of the contextView as follows:

CGPoint touch = [pan locationInView:self.contextView];

I believe the correct way to do this is:

CGPoint touch = [pan locationInView:self.contextView.window];

which fixes the drag point for the keyboard.

@jessesquires
Copy link
Owner

Thanks @kostub !

@jessesquires jessesquires added this to the 7.1.2 milestone Aug 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants