cordova-plugin-keyboard icon indicating copy to clipboard operation
cordova-plugin-keyboard copied to clipboard

Shrinkview creates empty space

Open aesmon opened this issue 9 years ago • 16 comments

Image: http://puu.sh/n4gOl/1a822edff3.png

As seen on the picture, with shrinkview enabled I am getting a lot of empty space that is not part of my HTML. My view has position absolute and I was using Ionic keyboard previously to shrink my HTML DOM container manually when keyboard was shown. Shrinkview(false) also does not behave as expected as it pushes my webview up instead of having the keyboard overlay it.

Any ideas? Thank you

aesmon avatar Feb 11 '16 19:02 aesmon

scrollViewDidScroll never gets called in my case

edit: just realized I have another scrollViewDidScroll initialized in Cordova-Google-Maps which takes over and keyboard event is not fired. Wish I actually knew Objective C/iOS development, but I will keep experimenting.

aesmon avatar Feb 11 '16 20:02 aesmon

Both this plugin and the google maps plugin assign themselves as the scrollview delegate with this line self.webView.scrollView.delegate = self;

There can only be one delegate so the plugin that is initialized second will win. Have you tried removing the google maps plugin?

cjpearson avatar Feb 12 '16 17:02 cjpearson

Thanks for the reply. It does work when removing scrollView.delegate from google maps. For the time being I have modified the google maps plugin as I didn't really need to listen to scrollViewDidScroll for my use case.

From technical perspective - is it even possible to assign custom scrollViewDidScroll per plugin or is calling self.webView.scrollView.delegate = self; at plugin execution times the only option to switch between those? Not really sure about the performance overhead it carries.

aesmon avatar Feb 12 '16 17:02 aesmon

The scrollView only calls one scrollViewDidScroll method. I think the only way to make this work is to have some third object that receives scrollViewDidScroll and then calls scrollViewDidScroll on both this plugin and the google maps plugin.

That would require changes to both plugins to register with the manager object instead of attaching themselves as the delegate directly.

cjpearson avatar Feb 12 '16 18:02 cjpearson

I'm having the same issue (when the Keyboard is open, blank space like the screenshot above) with an Ionic 2 project, except this plugin is my only active scrollView delegate. And I noticed if I open or close the little iOS 8-9 3-word autoprediction bar, the empty space goes away.

Any ideas?

apparition47 avatar Apr 19 '16 22:04 apparition47

exact same to me as @apparition47 said: open/close of that extra bar resizes correctly

mashpie avatar Apr 30 '16 14:04 mashpie

Opening and closing that bar triggers a keyboard frame change event which we listen to for resizing the webview. So it makes sense that it could fix the issue. I'm not sure why the issue is occurring though.

Since it's not related to google maps, could one of you open a new issue and add some details? A runnable code sample showing the issue would also be helpful.

cjpearson avatar May 03 '16 10:05 cjpearson

I was hoping to provide some example code... but didn't manage to find time building one yet. So, basically it's a setup with some fixed positioned bars, like in http://goratchet.com/ + phonegap 6.2.0

mashpie avatar May 09 '16 10:05 mashpie

Any updates on this? I'm still having the same issue.

josiaho avatar Mar 11 '17 04:03 josiaho

@josiaho I wasn't able to reproduce it. Do you have some sample code that shows the issue?

cjpearson avatar Mar 12 '17 22:03 cjpearson

Thanks for the response! Here you go. There's a scrolling textarea with a fixed position. When it is focused the keyboard comes up but looks like it adds an additional keyboard-height space above it (screenshot). Please let me know what else you need. Thanks so much!

cordova-keyboard-bottom-space.zip

Screenshot: img_2278

josiaho avatar Mar 13 '17 02:03 josiaho

Has there been any update on this issue? I'm having the same issue as @mashpie.

jsavage86 avatar Jun 06 '17 03:06 jsavage86

@josiaho have you had any progress on this issue?

jsavage86 avatar Jul 18 '17 20:07 jsavage86

@jsavage86 No unfortunately. Sorry!

josiaho avatar Jul 19 '17 05:07 josiaho

@josiaho, are you able to use WKWebView in your application? Adding cordova-plugin-wkwebview-engine to the sample seemed to fix the issue for me.

cjpearson avatar Jul 25 '17 01:07 cjpearson

For me, only elements that are position: fixed are affected by this. Any element that is fixed does not seem to correctly calculate its position.

dminkovsky avatar Oct 28 '19 16:10 dminkovsky