Phonegap 2.6 with KeyboardShrinksView and HideKeyboardFormAccessoryBar
cordova, ios
Solution
This is a bug. It's caused by the WebView not being resized properly after the keyboard is displayed. By default, PhoneGap resizes the height of the WebView by subtracting the view frame by the height of the keyboard. But, it doesn't take into account the fact that the form accessory bar is hidden in that calculation.
Here's a temporary solution to this while PhoneGap fixes this bug:
In CDVViewController.m (under Classes/Cleaver), go to line 140. It should be within the (void) keyboardWilLShowOrHide function. In the showEvent if statement, it calculates the new size of the WebView based on the height of the keyboard.
Change the contents of the if statement to:
if (showEvent) {
newFrame.size.height -= keyboardFrame.size.height;
if ([@"true" isEqualToString: self.settings[@"HideKeyboardFormAccessoryBar"]]) {
newFrame.size.height += 45;
}
}
I added an extra if statement that also checks for the HideKeyboardFormAccessoryBar configuration. If it's set, it'll increase the size of the WebView by an additional 45 pixels (the height of the form accessory bar).
Problem
i have a problem with one of the new phonegap features in 2.6 (ios), finally they included an option to shrink the webview to handle fixed elements. Unfortunately in combination with the `HideKeyboardFormAccessoryBar` option set to true, a strange white bar appears instead of the AccessoryView (take a look at the screenshot). This is not happening when i set `KeyboardShrinksView` to false has anyone experienced a similar problem with the new version? is this a bug or a feature? ;) cheers horst.