Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Part of view is missing, when keyboard is showing and swipe back. #1361

Closed
uziwuzzy opened this issue Jun 8, 2018 · 14 comments
Closed

Comments

@uziwuzzy
Copy link

uziwuzzy commented Jun 8, 2018

Description

When there's navigation controller, everytime keyboard is showing, and swiping back is used, some part of the view is missing.
[Description of the issue]

Steps to Reproduce

  1. Create Two ViewControllers with NavigationBar in it, lets say "FirstVC" and "SecondVC", and then give SecondVC a textfield.
  2. FirstVC push to SecondVC
  3. Click the textfield to make keyboard show up
  4. while keyboard is showing up, swipe slowly a little bit until FirstVC is shown, but don't let the screen move back to firstVC.
  5. then the bug occured, where bottom or top layout is black.

Expected behavior: [there's no black part, the view should act normal when navigating through swiping]

Actual behavior: [everytime keyboard is showing, and swiping back is used, some part of the view is missing]

Reproduces how often: [100%]

Versions

Xcode: 9.4

Mac OS: 10.13.5

Device: 11.3

Device Name: iPhone 5se

Library Version: 6.0.3

Additional Information

This are sample demo, in this sample, the bug will go away when we push the SecondVC again, but In the app that I build, the bug itself always persist eventhough the view reappeared, and it sometimes occured in the top part or the bottom part.
the sampe code:
TesKyeboard.zip

sample videos how to reproduce:
bugKeyboard.zip

bugKeyboardSample.zip

@uziwuzzy uziwuzzy changed the title BUG Part of view is missing, when keyboard is showing and swipe back. [BUG] Part of view is missing, when keyboard is showing and swipe back. Jun 8, 2018
@achalkias
Copy link

achalkias commented Jun 12, 2018

Same issue here is there any update with this because it's really frustrating. I am unable to publish my apps as long as this bug still occurs.
HOPE FOR A SOLUTION!

@pmusolino
Copy link
Contributor

Same behavior here

@hackiftekhar
Copy link
Owner

okay, let me take a look into this.

@hackiftekhar
Copy link
Owner

I can reproduce this issue. Let me see what is the actual issue.

@hackiftekhar
Copy link
Owner

I found the cause, unfortunately it's hard to write workaround for that. What actually happens under the hood is, the gesture change the rootViewController.view's frame.

So here is the execution step by step:

  • tap on textField.
  • Library save view's current origin (0,0) and moves view's origin to (0,-44) to see textField correctly.
  • apply pop gesture.
  • keyboardWillHide called and app restore view's origin to (0,0).
  • cancel pop gesture.
  • textFieldViewDidBeginEditing called and again library tries to save view's current origin. But here the library finds that current view origin is (0,-44). Here is the problem.

Because that origin value comes from view.frame.origin so library think that it should be the correct value for view origin and we should restore view to this origin on textField dismiss.

@hackiftekhar
Copy link
Owner

hackiftekhar commented Jul 7, 2018

I wrote a workaround for this issue. Now if library detects that user is applying interactivePopGesture of it's navigationController then library will save topViewBeginOrigin in topViewBeginOriginWhilePopGestureRecognizerActive and rootViewController in rootViewControllerWhilePopGestureRecognizerActive weak variable.
Now when gesture has ended and next time textField becomes first responder then if rootViewController == rootViewControllerWhilePopGestureRecognizerActive we assign topViewBeginOrigin = topViewBeginOriginWhilePopGestureRecognizerActive. So it did the tweak.

@pmusolino
Copy link
Contributor

@hackiftekhar when do you have in plan to release this new version?

@hackiftekhar
Copy link
Owner

I'm planning to release this in couple of days (after checking/fixing couple of more issues).

@uziwuzzy
Copy link
Author

uziwuzzy commented Aug 1, 2018

any news about the release for this issue?

@hackiftekhar
Copy link
Owner

This is already released I think.

@calhouncole
Copy link

calhouncole commented Oct 17, 2018

I'm still able to repro this issue after the latest release (6.2.0). Has this been fixed for anyone else?

(Amazing library BTW!)

@hackiftekhar
Copy link
Owner

Then can you please share demo project @calhouncole ?

@uziwuzzy
Copy link
Author

For me, the solution is to dismiss the keyboard on viewWillDissappear

@douglasjunior
Copy link
Contributor

Any updates on this?

@hackiftekhar I think that @uziwuzzy have shared a demo project here: https://github.com/hackiftekhar/IQKeyboardManager/files/2084476/TesKyeboard.zip

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

No branches or pull requests

6 participants