Space between keyboard and message view

I am experiencing abnormal space between the keyboard and chats. Any help would be appreciated.

can anyone comment on this?

@landonferrier @Ryan_Anderson - please share the UIKit version you are using and the device/OS version you are testing with.

@taha.saghir I attached a screenshot of the two versions of the sdks from Swift package manager.

Screenshot 2024-04-24 at 2.20.26 PM

@landonferrier please share the device details also.

@taha.saghir it’s for iOS / iPhone

@Ryan_Anderson which iOS and iPhone version?

This occurs all on devices, but having it occurring right now on my iPhone 14 and iOS version 17.2

Thanks for the details! I’m having the engineers look into it.

@taha.saghir Appreciate it!

@Ryan_Anderson @landonferrier - the engineers have asked if there are any customizations on this view. If so, please share the implementation details/snippets.

No customizations on that view or any of the views inside of the channel list view controller, just showing the channel list view controller and this is when they go into a channel.

Got it. Let me relay it to the team.

We haven’t been able to reproduce the issue.

Please advise on the engineer’s comment below.

From the previous issue we know that they are using a custom tabbar, can you give me some structure on how they are attaching and using the tabbar?

Internally, UIKit use UITabbarController to handle the height calculation without any problem, but looking at their screenshots, it looks like they have a custom implementation that doesn’t recognize the tabbar internally.

We are using a UITabBarController subclass, utilizing the UITabBar. It does have a custom height. Does the SDK not automatically adjust for this? Does a custom height need to be set somewhere?

Thank you for your patience as we continue to investigate it. Please advise on the below comment from the engineer.

Their Custom class inherits from the UITabbarController, but the actual tab bar used is configured as a UIStackView rather than a UITabbar, which behaves independently of the tab bar used in the UITabbarController, making it difficult for the SDK to determine and calculate the height value.

I’m trying some tests to reproduce it, but it’s hard to reproduce based on the logic we have seen previously.
If possible, could you ask them for the Tabbar logic they are currently using?

  • In particular, the logic for setting viewControllers on the tabbar.

Here’s the class:

class RootStackTabViewController: UIViewController {

    @IBOutlet weak var bottomStack: UIStackView!
    @IBOutlet weak var containerView: UIView!
    @IBOutlet weak var containerViewBottomConstraint: NSLayoutConstraint! // Reference to the bottom constraint of containerView
    
    var currentIndex = 0
    var viewControllers: [UIViewController] = []
    private var selectedViewController: UIViewController?

    lazy var tabs: [StackItemView] = {
        var items = [StackItemView]()
        for _ in 0..<4 {
            items.append(StackItemView.newInstance)
        }
        return items
    }()
    
    lazy var tabModels: [BottomStackItem] = {
        return [
            BottomStackItem(title: "Trips", image: "tab_trips"),
            BottomStackItem(title: "Chats", image: "tab_chat"),
            BottomStackItem(title: "Members", image: "tab_members"),
            BottomStackItem(title: "Profile", image: "tab_profile")
        ]
    }()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.setupTabs()
        self.setupViewControllers()
        self.selectViewController(at: currentIndex)
        self.view.backgroundColor = .white
    }

    func setupTabs() {
        for (index, model) in self.tabModels.enumerated() {
            let tabView = self.tabs[index]
            model.isSelected = index == 0
            tabView.item = model
            tabView.delegate = self
            self.bottomStack.addArrangedSubview(tabView)
            self.bottomStack.backgroundColor = .white
        }
    }
    
    func setupViewControllers() {
        let tripsVC = TripsVC()
        let chatsVC = ChatsVC()
        chatsVC.navigationController?.navigationItem.leftBarButtonItem = nil
        let membersVC = MembersVC()
        let profileVC = MyProfileVC()
        
        let controllers = [tripsVC, chatsVC, membersVC, profileVC]
        viewControllers = controllers.map({
            
            return UINavigationController(rootViewController: $0)
        })
    }
    
    func selectViewController(at index: Int) {
        
        if index < 0 || index >= viewControllers.count { return }
        let newViewController = viewControllers[index]

        // Remove the current view controller
        if let currentVC = selectedViewController {
            currentVC.willMove(toParent: nil)
            currentVC.view.removeFromSuperview()
            currentVC.removeFromParent()
        }

        // Add the new view controller
        addChild(newViewController)
        newViewController.view.frame = containerView.bounds
        containerView.addSubview(newViewController.view)
        containerView.backgroundColor = .clear
        newViewController.didMove(toParent: self)

        // Update the selected view controller
        selectedViewController = newViewController
        currentIndex = index
    }

    func setHiddenTabBar(_ hidden: Bool) {
        
        bottomStack.isHidden = hidden
        if hidden {
            containerViewBottomConstraint.constant = 0
        } else {
            containerViewBottomConstraint.constant = 90
        }

        self.view.layoutIfNeeded()
    }
}

extension RootStackTabViewController: StackItemViewDelegate {
    
    func handleTap(_ view: StackItemView) {
        guard let index = self.tabs.firstIndex(where: { $0 === view }), index != currentIndex else { return }
        
        // Update UI for previously selected tab
        self.tabs[currentIndex].isSelected = false
        
        // Update UI for newly selected tab
        view.isSelected = true
        
        // Select the new view controller
        selectViewController(at: index)
    }
}

We know what the height is for the tab bar, can we just set the height?

2 Likes

Any update on this? Thanks

@Ryan_Anderson – the team has been investigating it. There is no resolution/recommendation yet. I will keep you posted as I hear back. Thank you for your patience!

In the next release, we are going to add the ability to customize the keyboard and tabbar height. We will update here with the instructions when it’s ready.