Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Might be wrong keyboard height #113

Open
Wh1rlw1nd opened this issue Dec 28, 2021 · 0 comments
Open

Might be wrong keyboard height #113

Wh1rlw1nd opened this issue Dec 28, 2021 · 0 comments

Comments

@Wh1rlw1nd
Copy link

Wh1rlw1nd commented Dec 28, 2021

Hi, I am getting a bit strange (unusuable results) for this:

RxKeyboard.instance.visibleHeight
         .drive(onNext: { [weak postCommentContainerConstraint] keyboardVisibleHeight in
             print("Keyboard visible height \(keyboardVisibleHeight)")
             
             self.view.setNeedsLayout()
             UIView.animate(withDuration: Constants.kCommentBoxAnimationDuration) {
                 
                 postCommentContainerConstraint?.constant = keyboardVisibleHeight
                     self.view.layoutIfNeeded()
                   }
         })

postCommentContainerConstraint is constraint that defines distance between custom view bottom and a container view bottom. If I hardcode value, it works as it should. A pic from storyboard:

the output is:
Screenshot 2021-12-28 at 1 33 10 PM

Keyboard visible height 291.0
Keyboard visible height 335.0
Keyboard visible height 0.0
Keyboard visible height 335.0
Keyboard visible height 0.0
Keyboard visible height 335.0
Keyboard visible height 0.0
Keyboard visible height 335.0

The thing is the actual visible height of a keyboard (along with a toolbar) is around 260.

Why I am getting different and wrong values?

My current setup is, I have a tabbar, and a tableview. Over the tableview I have a custom view with a textView.
I want to slide it up and down as keyboard shows/hides.

What am I doing wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant