SlackTextViewController icon indicating copy to clipboard operation
SlackTextViewController copied to clipboard

Inputbar incorrect position after keyboard appear on iPad presented as formsheet

Open lingzlu opened this issue 8 years ago • 0 comments

  • [x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [x] I've read and agree to the Code of Conduct.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.

Description

When present SLKTextViewController on iPad in formsheet style. Input bar position was not computed correctly when keyboard appears. Portrait orientation does not repro the issue.

Reproducible in:

  • [x] This is reproducible in the sample project. SlackTextViewController version: 1.9.6 iOS version(s): iOS 11 Device(s): iPad Air 2

Steps to reproduce:

  1. Run the sample app "Messenger-iPad-sheet" on iPad
  2. Change device orientation on landscape
  3. Invoke keyboard on the input bar by using one of navigation bar actions.

Expected result:

Input bar should be stick on top of keyboard.

Actual result:

There is an empty gap between the input bar and the keyboard.

Attachments:

image

Investigation

Briefly look at the source code, I suspect the problem is in https://github.com/slackhq/SlackTextViewController/blob/37f91f23414dda33db5ce43a20958f19ddbd7b1d/Source/SLKTextViewController.m#L405-L423 When keyboard appeared on landscape, the formsheet is been pushed up. ConvertRect will return the keyboardRect on origin view frame, result in incorrect keyboardHeight been computed. I tried to fix the issue by moving https://github.com/slackhq/SlackTextViewController/blob/37f91f23414dda33db5ce43a20958f19ddbd7b1d/Source/SLKTextViewController.m#L1407-L1409 from slk_willShowOrHideKeyboard to slk_didShowOrHideKeyboard. But then it loses smooth transition on input bar moving up with keyboard. Any suggestions?

lingzlu avatar Nov 14 '17 03:11 lingzlu