-
Notifications
You must be signed in to change notification settings - Fork 149
cordova.plugins.Keyboard does not working #27
Comments
WkWebView doesn't seem to have an equivalent of UIWebView's |
Is there way to disable scrolling view when keyboard is open? Most common for mobile apps is fixed view or shrinked view with opened keyboard, but not scrolled over top of mobile screen. |
Hi @robaweb, If you want this as a feature for your app and you're using XCode, then you could do something like this to disable scroll when the keyboard is shown: MyMainViewController.m, method
And add this method to the same class:
In the same way you could re-enable scrolling when the keyboard is hidden. It would be possible to use this same approach to sync this with the Ionic keyboard plugin, but as that may not be necessary I won't elaborate on that. |
@EddyVerbruggen That doesn't seem to work in my app (the view is still scrolled). |
+1 |
1 similar comment
+1 |
+1 Really would like a fix for this. |
+1 |
1 similar comment
+1 |
Played with this a bit more. Bad news, but feel free to poke at this as well:
|
Using Using A fix for this is to use:
This scrolls the webview back to the center after the keyboard scrolls the webview to the left. This is not a clean fix though, you can still see a slight change happening. |
+1 I'm also hitting this issue. My team was interested in using the I was able to get a partial fix working with the cordova-plugin-keyboard. The following changes will cause the webview to shrink appropriately when the keyboard comes up. However, when the user begins typing the webview's internal I created the following method in - (void)changeFrame:(CGRect)newFrame {
self.wkWebView.frame = newFrame;
// Setting the content of the scrollView to the same size and offset as the frame.
[self.wkWebView.scrollView setContentOffset:CGPointMake(0.0, 0.0) animated: false];
[self.wkWebView.scrollView setContentSize:CGSizeMake(newFrame.size.width, newFrame.size.height)];
} Then in [((ReroutingUIWebView*)self.webView) changeFrame:[self.webView.superview convertRect:screen fromView:self.webView]]; This requires an If you have any ideas on how to fix this issue, please let me know! |
@EddyVerbruggen, thanks for the quick reply! I created a repo that captures this issue: https://github.com/rumit91/PhoneGapKeyboardIssue. I didn't get my partial fix working the same way I have it our production repo (see readme for details), but this still illustrates the problem that we are experiencing. Any ideas? |
I was finally able to clean up my partial fix and get my production repo to work the way we intended it to (similar to the messages app on iOS) by adding the following to the - (void)layoutSubviews {
self.wkWebView.frame = self.frame;
self.wkWebView.scrollView.delegate = self;
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
[self.scrollView.delegate scrollViewDidScroll:scrollView];
} Two things are going on here:
@EddyVerbruggen, do you think this is a valid solution? If you agree, I can get it working in my test repo and then submit a pull request. |
@rumit91 Amazing work, I'd love to integrate the fix if we can add this to And how about pushing the adjusted |
Yes, this pull request (#124) should not change the behavior for people not using |
@rumit91 Thanks so much for the PR, it's now been merged into master. Perhaps a few peeps want to try it before I tag a new release. My own tests have been very promising. |
@EddyVerbruggen Thank you! |
Thank you all! To clarify; No need to install any additional packages, the above PR should solve this issue? :) |
@hussfelt You need toalso install |
Is this fix in master? I just installed this and the keyboard and the |
error setHackishlyHidesInputAccessoryView:]: unrecognized selector sent to instance 0x7fd139d53ee0 |
@northkode From your error it looks like you are running the Ionic Keyboard Plugin. This fix should address the issues with |
ok ill give that a go. Thanks! |
I installed the repo mentioned but the functionality does not work. and no onShow events are fired.. the functions never run. |
Would you mind showing us your code or an example project that we can debug? |
i can't build a sample project at the moment.. I will try and put some nslogs in the keyboard methods and see if its even trying to apply the changes. using the exact same plugin without your wkwebview it works great. |
Ok I'll try to find some time in the next few days to test it out more. It seems to work great in my production code, so I'm not sure why it's not working as expected :( |
@northkode could you double check that you have the right version of the WKWebView plugin? Does your Here's my example project that illustrates the keyboard plugin working with the wkwebview using the fix above. I'm currently trying to figure out why the scrolling behavior does not work as expected when the keyboard is active, but that's a different problem and shouldn't affect the |
I really would like to us WKWebView if the keyboard problem was solved. Is the problem with hiding accessory bar and scrolling fixed with the above PR? |
The scroll should be fine (in master, not in a released version yet). The accessory bar can't be hidden. |
@EddyVerbruggen That's great! I think having the accessory bar will be an acceptable compromise for the performance boost you get. Do you also happen to know the status bar problem? I am using Meteor-ionic, and this issue describes the problem I encounter with the current version of WKWebview. Could you tell me if these problems have been fixed? |
@rumit91 your code saved a ton of work. For anyone who will struggle in future, this is a way to get |
Thanks @woniesong92! @berickson1 actually found an even better fix. It's already in master so you should be able to get it using My team and I were still able to hide the accessory bar using the cordova.plugin.Keyboard and the @clauderic I had submitted this pull request that should make the WKWebView respect the background color property set in config.xml. However, looking back at our app it looks like that didn't completely fix the problem or there was some regression. The black background still appears when the keyboard is brought up but it at least goes to white when the keyboard is dismissed. Try setting that background color property and see what happens. |
Hi @rumit91 that PR did work, but the recent keyboard scroll fix has broken this. Thanks @clauderic for the gif. With the latest release (0.5.0) this should be fixed. Default is white and it can be overridden as before. |
I'd like to use cordova-plugin-wkwebview-engine along with cordova.plugins.Keyboard. Has this been incorporated there? |
Hi!
cordova.plugins.Keyboard.hideKeyboardAccessoryBar and cordova.plugins.Keyboard.disableScroll have not effect :( For ionic keyboard plugin it's same issue too.
Tested on iOS sdk 8.1, cordova 3.7.0 and 3.6.x, org.cordova.plugins.keyboard latest version. Also i tried use latest org.cordova.plugins.labs.keyboard and steel not working.
Without WKWebView all is fine.
Is it possible to fix it?
The text was updated successfully, but these errors were encountered: