# Space between keyboard and message view

**URL:** <https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332>\
**Category:** Miscellaneous\
**Created:** [April 5, 2024, 5:28pm UTC](https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332 "2024-04-05T17:28:37Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![landonferrier](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/landonferrier/32/5072_2.png) [@landonferrier](https://community.sendbird.com/u/landonferrier)\
**Post date:** [April 5, 2024, 5:28pm UTC](https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332/1 "2024-04-05T17:28:37Z")

</div>

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

 ![IMG_2531](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/2X/4/4c50a09e4fd59e8e74fadbc3e5c0ede5ebb40487.jpeg)

---

<div class="post-metadata">

**Author:** ![Ryan\_Anderson](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/ryan_anderson/32/4604_2.png) [@Ryan\_Anderson](https://community.sendbird.com/u/Ryan_Anderson)\
**Post date:** [April 22, 2024, 7:03pm UTC](https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332/2 "2024-04-22T19:03:34Z")

</div>

can anyone comment on this?

---

<div class="post-metadata">

**Author:** ![taha.saghir](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/taha.saghir/32/2094_2.png) [@taha.saghir](https://community.sendbird.com/u/taha.saghir)\
**Post date:** [April 24, 2024, 3:44pm UTC](https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332/3 "2024-04-24T15:44:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![landonferrier](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/landonferrier/32/5072_2.png) [@landonferrier](https://community.sendbird.com/u/landonferrier)\
**Post date:** [April 24, 2024, 6:20pm UTC](https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332/4 "2024-04-24T18:20:51Z")

</div>

@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](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/2X/8/84b23431c9d388caec7f3c0cfb6c68f192d6aa67.png)

---

<div class="post-metadata">

**Author:** ![taha.saghir](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/taha.saghir/32/2094_2.png) [@taha.saghir](https://community.sendbird.com/u/taha.saghir)\
**Post date:** [April 24, 2024, 6:32pm UTC](https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332/5 "2024-04-24T18:32:58Z")

</div>

@landonferrier please share the device details also.

---

<div class="post-metadata">

**Author:** ![Ryan\_Anderson](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/ryan_anderson/32/4604_2.png) [@Ryan\_Anderson](https://community.sendbird.com/u/Ryan_Anderson)\
**Post date:** [April 24, 2024, 6:45pm UTC](https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332/6 "2024-04-24T18:45:22Z")

</div>

@taha.saghir it’s for iOS / iPhone

---

<div class="post-metadata">

**Author:** ![taha.saghir](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/taha.saghir/32/2094_2.png) [@taha.saghir](https://community.sendbird.com/u/taha.saghir)\
**Post date:** [April 24, 2024, 6:46pm UTC](https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332/7 "2024-04-24T18:46:44Z")

</div>

@Ryan_Anderson which iOS and iPhone version?

---

<div class="post-metadata">

**Author:** ![landonferrier](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/landonferrier/32/5072_2.png) [@landonferrier](https://community.sendbird.com/u/landonferrier)\
**Post date:** [April 24, 2024, 7:38pm UTC](https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332/8 "2024-04-24T19:38:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![taha.saghir](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/taha.saghir/32/2094_2.png) [@taha.saghir](https://community.sendbird.com/u/taha.saghir)\
**Post date:** [April 24, 2024, 9:08pm UTC](https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332/9 "2024-04-24T21:08:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ryan\_Anderson](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/ryan_anderson/32/4604_2.png) [@Ryan\_Anderson](https://community.sendbird.com/u/Ryan_Anderson)\
**Post date:** [April 26, 2024, 2:45am UTC](https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332/10 "2024-04-26T02:45:50Z")

</div>

@taha.saghir Appreciate it!

---

<div class="post-metadata">

**Author:** ![taha.saghir](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/taha.saghir/32/2094_2.png) [@taha.saghir](https://community.sendbird.com/u/taha.saghir)\
**Post date:** [April 26, 2024, 3:25pm UTC](https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332/11 "2024-04-26T15:25:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![landonferrier](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/landonferrier/32/5072_2.png) [@landonferrier](https://community.sendbird.com/u/landonferrier)\
**Post date:** [April 26, 2024, 3:39pm UTC](https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332/12 "2024-04-26T15:39:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![taha.saghir](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/taha.saghir/32/2094_2.png) [@taha.saghir](https://community.sendbird.com/u/taha.saghir)\
**Post date:** [April 26, 2024, 4:02pm UTC](https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332/13 "2024-04-26T16:02:32Z")

</div>

Got it. Let me relay it to the team.

---

<div class="post-metadata">

**Author:** ![taha.saghir](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/taha.saghir/32/2094_2.png) [@taha.saghir](https://community.sendbird.com/u/taha.saghir)\
**Post date:** [April 30, 2024, 3:36pm UTC](https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332/14 "2024-04-30T15:36:46Z")

</div>

We haven’t been able to reproduce the issue.

 ![IMG_6611](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/2X/7/70b8b729fe3222021864ee79531ec1c83ccfc075.png)

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.

---

<div class="post-metadata">

**Author:** ![landonferrier](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/landonferrier/32/5072_2.png) [@landonferrier](https://community.sendbird.com/u/landonferrier)\
**Post date:** [April 30, 2024, 8:24pm UTC](https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332/15 "2024-04-30T20:24:05Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![taha.saghir](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/taha.saghir/32/2094_2.png) [@taha.saghir](https://community.sendbird.com/u/taha.saghir)\
**Post date:** [May 3, 2024, 2:54pm UTC](https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332/16 "2024-05-03T14:54:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![landonferrier](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/landonferrier/32/5072_2.png) [@landonferrier](https://community.sendbird.com/u/landonferrier)\
**Post date:** [May 3, 2024, 3:59pm UTC](https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332/17 "2024-05-03T15:59:14Z")

</div>

Here’s the class:

```auto
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?

---

<div class="post-metadata">

**Author:** ![Ryan\_Anderson](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/ryan_anderson/32/4604_2.png) [@Ryan\_Anderson](https://community.sendbird.com/u/Ryan_Anderson)\
**Post date:** [May 7, 2024, 7:08am UTC](https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332/18 "2024-05-07T07:08:52Z")

</div>

Any update on this? Thanks

---

<div class="post-metadata">

**Author:** ![taha.saghir](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/taha.saghir/32/2094_2.png) [@taha.saghir](https://community.sendbird.com/u/taha.saghir)\
**Post date:** [May 7, 2024, 3:37pm UTC](https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332/19 "2024-05-07T15:37:00Z")

</div>

@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!

---

<div class="post-metadata">

**Author:** ![taha.saghir](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/taha.saghir/32/2094_2.png) [@taha.saghir](https://community.sendbird.com/u/taha.saghir)\
**Post date:** [May 8, 2024, 6:22pm UTC](https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332/20 "2024-05-08T18:22:08Z")

</div>

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.

[Next page](https://community.sendbird.com/t/space-between-keyboard-and-message-view/9332.md?page=2)
