Reputation: 3395
I am using MessageKit 3.0.0-swift5
branch for chats.
Clicking on the message, I am presenting the ViewController.
When Viewcontroller is dismissed, I am not able to access InputBar.
Has anybody come across this issue?
Check the video here.
Code:
// MessageCellDelegate
func didTapMessage(in cell: MessageCollectionViewCell) {
self.showFileInBrowser(withTitle: "", url: fileURL)
}
func showFileInBrowser(withTitle title: String? = nil, url: URL) {
self.fileBrowser = FileBrowserViewController(title: title, url: url)
let navigation = BaseNavigationController(rootViewController: fileBrowser!)
self.present(navigation, animated: true, completion: nil)
}
// FileBrowserViewController
@objc func closeButtonTapped() {
self.dismiss(animated: true, completion: nil)
}
I am also using IQKeyboardManager, but the below solution is not working.
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
IQKeyboardManager.shared().isEnabled = false
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
IQKeyboardManager.shared().isEnabled = true
}
Upvotes: 3
Views: 2167
Reputation: 942
I had the same issue in my application, which is using just InputBarViewController
(in some reasons I had to implement my own chat, not using MessageKit).
So, this issue is very easy to reproduce if you are trying to show some modal view controller not from current controller, or even moving first responder focus to another UITextField
within current VC (e.g. search field).
For me working solution is just call becomeFirstResponder
on current view controller instance just after resigning control from search field or inside viewDidAppear
(or in some other place where you can be sure, chat UI is visible again).
P.S. I also faced this issue when UIContextMenu
(long touch in cell) was dismissed. Solution was pretty the same.
Upvotes: 1
Reputation: 989
I too facing that issue before, but i tried to to present nextViewController
as by adding the following code. hope it will work.
nextViewController.modalPresentationStyle = .overCurrentContext
nextViewController.modalTransitionStyle = .coverVertical
Upvotes: 0
Reputation: 21
I think that you have to before present the next ViewController disable Keyboard by TextView.resignFirstResponder()
Because the problem begins while ViewController is Presenting
Upvotes: 0