-
Notifications
You must be signed in to change notification settings - Fork 175
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
Bug on iPhone X #84
Comments
Hey, not sure it is related: I'm also experience this bug on X with google keyboard. It is reporting wrong |
Having the same issue. Not sure if someone tested with iPhone X models. safeAreaInsets are not taken into account and when using visibleHeight it is 0 because it hasn't been drawn yet. |
Same issue on me. |
Same issue on my project without SnapKit. I solved it as follows.
and
Reference |
Same issue on me as well.
I am wondering where this constraint is hanging. @shingo-nakanishi Could you answer me? |
I solved as follows. RxKeyboard.instance.visibleHeight
.drive(onNext: { [weak self] keyboardVisibleHeight in
guard let `self` = self, self.didSetupViewConstraints else { return }
self.messageInputBar.snp.remakeConstraints { make in
make.left.right.equalTo(0)
if #available(iOS 11.0, *) {
if keyboardVisibleHeight == 0 {
make.bottom.equalTo(self.view.safeAreaLayoutGuide.snp.bottom).offset(-keyboardVisibleHeight)
}
else {
make.bottom.equalTo(self.view.snp.bottom).offset(-keyboardVisibleHeight)
}
} else {
make.bottom.equalTo(self.bottomLayoutGuide.snp.top).offset(-keyboardVisibleHeight)
}
}
self.view.setNeedsLayout()
UIView.animate(withDuration: 0) {
self.collectionView.contentInset.bottom = keyboardVisibleHeight + self.messageInputBar.height
self.collectionView.scrollIndicatorInsets.bottom = self.collectionView.contentInset.bottom
self.view.layoutIfNeeded()
}
})
.disposed(by: self.disposeBag) |
Hello,
On iPhone X, Xr, Xs in the example when you tap the search bar and the keyboard appear there is a gap between the bar and the keyboard. The reason is because it's constrained to the safe area in MessageListViewController (96) :
if #available(iOS 11.0, *) {
make.bottom.equalTo(self.view.safeAreaLayoutGuide.snp.bottom).offset(-keyboardVisibleHeight)
} else {
make.bottom.equalTo(self.bottomLayoutGuide.snp.top).offset(-keyboardVisibleHeight)
}
While this is intended behaviour when there is no keyboard this doesn't work when it open. I'm gonna try to fix it but if someone as a nice way to do it it would be great to have it in the example.
The text was updated successfully, but these errors were encountered: