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

Fix event.keyboardHeight value for iPad hardware keyboard bar #273

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

Conversation

rafbm
Copy link

@rafbm rafbm commented May 9, 2017

Disclaimer: this is the first ever Objective-C I wrote in my life. In fact, I just byte-for-byte copied the code from cordova-plugin-keyboard.

When connecting a hardware keyboard, iPads hide the full software keyboard but still show a reduced bar with undo / redo / paste, etc.:

bar

This can be tested by hitting Cmd + Shift + K or Hardware > Keyboard > Connect Hardware Keyboard in the iOS Simulator.

Before the fix, the keyboardHeight value of the native.keyboardshow event with hardware keyboard connected was 313, exact same as full software keyboard. For instance, this caused our app to apply a wrong margin-bottom, as shown here (light grey area):

before

After the fix, keyboardHeight now returns 55, which is the actual height of the hardware keyboard bar alone:

after

Tested with the following devices on iOS Simulator, in both portrait and landscape:

  • iPad Pro 9.7 inch - iOS 10.3
  • iPad Pro 12.9 inch - iOS 10.3
  • iPad Air 2 - iOS 9.3
  • iPhone 7 Plus - iOS 10.3
  • iPhone 5S - iOS 9.3

@PvanHengel
Copy link

Any idea when this fix will be merged we are having the same issue and would like the fix asap.

@R1Daneel
Copy link

R1Daneel commented Jun 7, 2017

Are there news about this PR? We have the same problem on our project

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.

None yet

3 participants