// Detailed description of issue.
I have a container view which is parent of messageViewController and below that I have a custom input field and when I tap into the input field and keyboard is visible the message tableview is moving up and leaving a very large gap but I have constraint it to the top of my input field view. There is no way to unregister the keyboard observer in SBUBaseChannelViewController.
[UIKit Version]
// What version of the SDK are you using?
SendbirdSDK 3.1.42
SendbirdUIKit 3.3.6
[Reproduction Steps]
// Please provide reproduction steps and, if possible, code snippets.
In the below code snippet viewBottomContraint is bottom constraint of my input field view bottom constraint and view hierarchy is message container view is on top of input field view and bottom of message container view is mapped with top of input field view so when keyboard is visible the input field is moving upward which is as expected but the message tableview is leaving a huge gap between last message and input field view, I am also attaching an image.
override func viewDidLoad() {
super.viewDidLoad()
// Initialize and configure Sendbird's GroupChannelViewController
guard let user else { return }
messagesViewController = SBUGroupChannelViewController(channel: user)
// Hide the input components in Sendbird's UI
messagesViewController.inputComponent?.isHidden = true
// Remove the input component's space by setting its height to zero
messagesViewController.inputComponent?.heightAnchor.constraint(equalToConstant: 0).isActive = true
// Disable vertical scroll indicator in the tableView
messagesViewController.listComponent?.tableView.showsVerticalScrollIndicator = false
// Add messagesViewController's view to the container
addChild(messagesViewController)
messageContainerView.addSubview(messagesViewController.view)
messagesViewController.view.frame = messageContainerView.bounds
messagesViewController.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
messagesViewController.didMove(toParent: self)
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(notification:)), name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(notification:)), name: UIResponder.keyboardWillHideNotification, object: nil)
}
@objc func keyboardWillShow(notification: Notification) {
if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue {
viewBottomConstraint.constant = keyboardSize.height - 60
UIView.animate(withDuration: 0.3) {
self.view.layoutIfNeeded() // Animate the layout
}
}
}
@objc func keyboardWillHide(notification: Notification) {
// Reset the bottom constraint to original value
viewBottomConstraint.constant = 0 // Move down to original position
UIView.animate(withDuration: 0.3) {
self.view.layoutIfNeeded() // Animate the layout
}
}
[Frequency]
// How frequently is this issue occurring?
Regular every time
[Current impact]
// How is this currently impacting your implementation?
Not able to proceed further because it is the most important part.
