SBUChannelViewController offset

1180793539932667.BCB9g4HoxTgeJMeZWXvZ_height640

Hello! I’m presenting my chat list with tab bar controller in the bottom. When I open any chat and start typing some message the white space above the keyboard is showed. How can I hide it?

I’m also using IQKeyboardManager, but I disable this framework for chat class in AppDelegate.swift like the following, so I’m sure it’s not connected with 3rd-party lib

IQKeyboardManager.shared.disabledToolbarClasses = [SBUChannelViewController.self]

@darya.karneichuk did you try to set disabledDistanceHandlingClasses instead toolbar?

I’ve tried this, not working, still a big space :frowning:
@Woo IQKeyboardManager.shared.keyboardDistanceFromTextField = 0 also not working

I will try with IQKeyboardManager and see if I can produce the result

@darya.karneichuk I set up IQKeyboardManager on sample and it ran without any problem :confused: Can you give me environment information such as iOS version, sdk versions?

Have you embedded it in tabbar controller? And SBUChannelViewController is pushed like navigationController?

@Woo Have you embedded it in tabbar controller? And SBUChannelViewController is pushed like navigationController?

Hey @darya.karneichuk sorry for being late. I will try the scenario like you said this week

I’m having this same issue, I want to keep the viewcontroller embedded into a tab bar.

I’m not using any extra dependencies for managing the keyboard

Was there any way to resolve this?

Managed to fix this by using the inputViewBottomConstraint to accommodate for the tabbar height when the keyboard appears…

class ChannelVC: SBUChannelViewController {
var tabBarHeight : CGFloat = 0.0

override func viewDidLoad() {
    super.viewDidLoad()
    tabBarHeight = tabBarController?.tabBar.frame.size.height ?? 0
}

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillAppear), name: UIResponder.keyboardWillShowNotification, object: nil)
}

@objc func keyboardWillAppear() {
    messageInputViewBottomConstraint.constant += tabBarHeight
}

override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)
    NotificationCenter.default.removeObserver(self)
}

}

Do you have tabbar on SBUChannelViewController? Could you tell me which SDK version are you using

My “ChannelVC” I posted above is nested in a navigation controller that is nested within a tab bar, yes. Using Sendbird UIKit version 2.0.7.

I have this same issue. Is there any other way to fix this? Does this means that we shouldn’t use SBUChannelViewController within a tab bar view controller?

This makes a big assumption that we must always use a UITabBarController rather than having a custom toolbar / tab bar of some sort to avoid. You can achieve the same look using view controller containment (child/parent) and have a very custom setup, but this breaks that.

I’ll be opening a support ticket, since it’s too rigid at the moment.

The source code in SBUBaseChannelViewController currently reads:

var tabBarHeight: CGFloat = 0.0
if self.tabBarController?.tabBar.isTranslucent == false {
    tabBarHeight = tabBarController?.tabBar.frame.height ?? 0.0
}
        
self.messageInputViewBottomConstraint.constant = -(keyboardHeight-tabBarHeight)

Hi @iwasrobbed,

Welcome to the Sendbird Community. Just a note, we do not accept external pull requests to any of our repos. The best option would be to open a support case with our team and allow us to work with Engineering to see what can be done.

1 Like

Thanks @Tyler ! I’ve opened a support ticket just now (# 00025012)

Here’s the diff for how I’m working around it: See issue: SBUBaseChannelViewController · GitHub

The details of the enhancement ask are:

  1. channel view’s need a way to set a custom tab bar height, in the scenario that we don’t use a UITabBarController in our implementation but still have a custom tab bar to avoid

  2. alternatively (maybe preferably), channel view’s need to respect the additionalSafeAreaInsets in the keyboard offset calculation, since that’s what I’m currently using to offset the message input view. It works well for the hidden keyboard case, but breaks once keyboard shows

Thanks for that! I’ll pass this feedback on to our Engineering team and keep you updated via the case you created.

1 Like