IQKeyboardManager icon indicating copy to clipboard operation
IQKeyboardManager copied to clipboard

View does not move up for the first time when tapped on textview

Open NalineeSingh01 opened this issue 3 years ago • 8 comments

Keyboard covers the view, the first time something is typed in text view. From second time everything works fine. To Reproduce Steps to reproduce the behavior:

  1. Tap on a textview
  2. keyboard shows up but the view does not moves up hence keyboard covers the view.

Expected behavior View should move up showing the text view after the keyboard is up.

Screenshots https://user-images.githubusercontent.com/68046022/135574316-510f9f36-e02a-4e2d-8c50-fc7db966a091.MP4

Demo Project keyboardIssue.zip

Versions

Xcode: 12.4 (12D4e) **Mac OS: 11.2.1 **Device: tested on iPhone 6s (reproducable on any iPhone device) **Library Version: IQKeyboardManagerSwift (6.5.6)

NalineeSingh01 avatar Oct 01 '21 06:10 NalineeSingh01

Happening to me as well. Waitin for the update to be live. Our users are facing this issue in our live app now.

ahsanaasim avatar Oct 17 '21 20:10 ahsanaasim

Happening to me as well. Waitin for the update to be live. Our users are facing this issue in our live app now.

Till the new update is out, you can try this - IQKeyboardManager.Swift -> func textFieldViewDidBeginEditing

look for below comment and code -

//On textView toolbar didn't appear on first time, so forcing textView to reload it's inputViews. textView.reloadInputViews()

now just below above mentioned code add these two lines to remove the issue

textView.resignFirstResponder() textView.becomeFirstResponder()

NalineeSingh01 avatar Oct 18 '21 05:10 NalineeSingh01

@NalineeSingh01 have you done: import: IQKeyboardManagerSwift to the App Delegate and then you need to put IQKeyboardManager.shared.enable = true inside the didFinishLaunchingWithOptions method also in App Delegate

https://github.com/hackiftekhar/IQKeyboardManager Screenshot 2021-10-23 at 17.02.55.pdf

Flexology avatar Oct 23 '21 16:10 Flexology

@Flexology Yes this was already done in AppDelegate.

NalineeSingh01 avatar Oct 26 '21 06:10 NalineeSingh01

I also encounter such problem, how does the building Lord solve this problem

zhujian521 avatar Nov 05 '21 07:11 zhujian521

I'll need to check the demo project to see if that fixes the problem or not.

hackiftekhar avatar Nov 05 '21 11:11 hackiftekhar

The problem still exists, on iPhone SE 1gen is reproduced

JAGUAR108 avatar Apr 04 '22 10:04 JAGUAR108

In my case, I notice the keyboard will work fine if got some delay by long press or make a debug point when I running my project. So i put this code and it looks works.

Solution 1: //On textView toolbar didn't appear on first time, so forcing textView to reload it's inputViews.

textView.reloadInputViews()

DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.05) { (self.textFieldView as? UITextView)?.reloadInputViews() }

Solution 2: In your own VC,

textView.delegate = self

func textViewDidBeginEditing(_ textView: UITextView) { DispatchQueue.main.async { textView.reloadInputViews() } }

kienwei518 avatar Apr 08 '22 06:04 kienwei518

I checked the demo project and it looks like it's no longer reproducible with the demo project and with the iPhone SE 1st generation as well.

hackiftekhar avatar Oct 02 '23 13:10 hackiftekhar

Hi,This issue still exists in the latest version, iPhone 6s plus 14.7.1

Arya-Wang avatar Nov 21 '23 06:11 Arya-Wang