Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

fixed issue where input bar only appeared behind keyboard (#605, #615) #652

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tditchek
Copy link

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've been mindful about doing atomic commits, adding documentation to my changes, not refactoring too much.
  • I've added a descriptive title and added any useful information for the reviewer. Where appropriate, I've attached a screenshot and/or screencast (gif preferrably).
  • I've listed my changes on the [Changelog(https://github.com/slackhq/SlackTextViewController/blob/master/CHANGELOG.md) file.
  • I've read, agree to, and signed the Contributor License Agreement (CLA).

PR Summary

Fixed the issue where the Input Bar was always hidden behind the keyboard. It was caused by the method slk_updateViewConstraints in SLKTextViewController.m being called every time viewSafeAreaInsetsDidChange was fired. This caused the problem by constraining the bottom of the InputBar to the bottom of a CGRectNull that was supposed to be representing the keyboard frame. I fixed it by adding a new iVar called _cachedKeyboardRect that would default to CGRectNull but store the keyboard frame when it's going to becomeFirstResponder. Then I added a method slk_updateViewConstraintsFromCachedKeyboard which sets the proper Input Bar constraints to the bottom of the _cachedKeyboardRect. I updated viewSafeAreaInsetsDidChange to call this method instead of the slk_updateViewConstraints that really should only apply when the keyboard isn't visible.

Related Issues

Fixes #615 and #605

@tditchek
Copy link
Author

@dzenbot I believe this issue was caused by one of the changes added to support the iPhone X, so add it to the iPhone X / iOS 11 update. thanks!

@JustinBobo
Copy link

Any updates here?

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

Successfully merging this pull request may close these issues.

Textview is behind the keyboard
2 participants