@@ -910,7 +910,6 @@ - (void)slk_didPanTextInputBar:(UIPanGestureRecognizer *)gesture
910910 static CGPoint startPoint;
911911 static CGRect originalFrame;
912912 static BOOL dragging = NO ;
913- static BOOL presenting = NO ;
914913
915914 __block UIView *keyboardView = [self .textInputbar.inputAccessoryView keyboardViewProxy ];
916915
@@ -933,40 +932,32 @@ - (void)slk_didPanTextInputBar:(UIPanGestureRecognizer *)gesture
933932 startPoint = CGPointZero;
934933 dragging = NO ;
935934
936- // Because the keyboard is on its own view hierarchy since iOS 9,
937- // we instead show a snapshot of the keyboard and hide it
938- // to give the illusion that the keyboard is being moved by the user.
939- if (SLK_IS_IOS9_AND_HIGHER && gestureVelocity.y > 0 ) {
940- [self .textInputbar showKeyboardMockup: YES ];
941- }
942-
943935 break ;
944936 }
945937 case UIGestureRecognizerStateChanged: {
946938
947- if (CGRectContainsPoint (self.textInputbar .frame , gestureLocation) || dragging || presenting ){
939+ if (CGRectContainsPoint (self.textInputbar .frame , gestureLocation) || dragging){
948940
949941 if (CGPointEqualToPoint (startPoint, CGPointZero)) {
950942 startPoint = gestureLocation;
951943 dragging = YES ;
952944
953- if (!presenting) {
954- originalFrame = keyboardView.frame ;
945+ // Because the keyboard is on its own view hierarchy since iOS 9,
946+ // we instead show a snapshot of the keyboard and hide it
947+ // to give the illusion that the keyboard is being moved by the user.
948+ if (SLK_IS_IOS9_AND_HIGHER && gestureVelocity.y > 0 ) {
949+ [self .textInputbar showKeyboardMockup: YES ];
955950 }
951+
952+ originalFrame = keyboardView.frame ;
956953 }
957954
958955 self.movingKeyboard = YES ;
959956
960957 CGPoint transition = CGPointMake (gestureLocation.x - startPoint.x , gestureLocation.y - startPoint.y );
961958
962959 CGRect keyboardFrame = originalFrame;
963-
964- if (presenting) {
965- keyboardFrame.origin .y += transition.y ;
966- }
967- else {
968- keyboardFrame.origin .y += MAX (transition.y , 0.0 );
969- }
960+ keyboardFrame.origin .y += MAX (transition.y , 0.0 );
970961
971962 // Makes sure they keyboard is always anchored to the bottom
972963 if (CGRectGetMinY (keyboardFrame) < keyboardMinY) {
@@ -1014,18 +1005,13 @@ - (void)slk_didPanTextInputBar:(UIPanGestureRecognizer *)gesture
10141005 }
10151006
10161007 CGPoint transition = CGPointMake (0.0 , fabs (gestureLocation.y - startPoint.y ));
1017-
10181008 CGRect keyboardFrame = originalFrame;
10191009
1020- if (presenting) {
1021- keyboardFrame.origin .y = keyboardMinY;
1022- }
1023-
10241010 // The velocity can be changed to hide or show the keyboard based on the gesture
10251011 CGFloat minVelocity = 20.0 ;
10261012 CGFloat minDistance = CGRectGetHeight (keyboardFrame)/2.0 ;
10271013
1028- BOOL hide = (gestureVelocity.y > minVelocity) || (presenting && transition. y < minDistance) || (!presenting && transition.y > minDistance);
1014+ BOOL hide = (gestureVelocity.y > minVelocity) || (transition.y > minDistance);
10291015
10301016 if (hide) keyboardFrame.origin .y = keyboardMaxY;
10311017
@@ -1048,7 +1034,6 @@ - (void)slk_didPanTextInputBar:(UIPanGestureRecognizer *)gesture
10481034 startPoint = CGPointZero;
10491035 originalFrame = CGRectZero;
10501036 dragging = NO ;
1051- presenting = NO ;
10521037
10531038 self.movingKeyboard = NO ;
10541039
0 commit comments