-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dark keyboard #20
Comments
I'm not opposed to including this, but I wonder why ionic removed it. Was it buggy or difficult to maintain? It would also be nice if there was support for android as well. |
Afaik the implementation changed in iOS 8, and it was just never updated :( |
I did a bit of research into this. It looks like keyboardAppearance is not supported with UIWebView. Ionic's solution and this one both involve swizzling methods of the webview's internal classes with limited success. I'm a bit hesitant to mess around too much with private API's given reports of Apple rejecting apps (#21), but if someone finds a reliable solution to this, I'd be happy to bring in a PR. |
I would avoid private API's. Apple has indeed started rejecting these http://blog.ionic.io/pluginz-be-buggin/ I'm not a native iOS developer at all; I can barely read Objective-C code. However, I submitted a fix for this accessary bar bug that doesn't use private API markshust/ionic-plugin-keyboard@9b0ff0c This seems to be the appropriate fix for iOS 9 and dark keyboards, however it uses private API's Is there any way the same method of my accessory bar fix can be utilized/modifying in a similar fashion for this dark keyboard? It's just a few lines, I find it a bit hard to believe that we can't have dark keyboards in cordova apps -- I was under the impression anything native can be adapted to cordova. Is this not the case? Please excuse my complete ignorance. Web dev here ;) |
It's not the method that's private, but UIWebBrowserView is an undocumented class that Apple uses within the UIWebView. It appears that Apple was running the strings tool on the binary and flagging any binary that contains the string "UIWebBrowserView". Try running The dark keyboard isn't a limitation of Cordova, but rather UIWebView. Keyboard appearance is defined for each control. Some controls, like UITextField allow you to set it, but UIWebView does not. |
I was able to get this to work based off of the iOS 9 solution. It's necessary to swizzle keyboardAppearance on both UIWebBrowserView and UITextInputTraits. You can try it by adding this code at the end of
|
I've added support in a test branch. It seems to work for me on an iOS 8 device and iOS 9 sim.
or
|
Awesome!! Thanks so much for popping it out so fast. I'll be testing it out later today. |
Sorry got behind on the holiday. Will test this out later today. |
@cjpearson this isn't working for me, on device or sim (9.3). I tried calling |
Sorry for the late reply. I'll update Xcode and see if I can reproduce this. Can you get it to work on older simulator versions? |
Sorry, no go. I'm only working with iOS 9+ right now. |
I'm still unable to reproduce this. Could you give more details? Here are the steps I followed:
Add
I then run it in XCode and it works fine on iPad and iPhone Sims on iOS 9.3 |
Hmmm. Your example is indeed working for me. I wonder if this is an issue with Meteor somehow (what I'm using it in), or perhaps they are running a different version of Cordova. I believe this is ok for you to merge in, as even though it wasn't working in my Meteor + Cordova app, it didn't cause any ill-advised side effects. |
What about android ? How to force dark keyboard style |
I'm using your plugin in ionic 2 app and setting the preference like |
The dark feature still only exists in an experimental branch. Are you using that branch? |
Yes using the dark branch. |
How do i use the dark branch? Do i have to put |
|
@cjpearson what is the status of this. I would love to see dark keyboard support in this plugin |
It should work if you install the dark branch. I haven't pulled it into the main branch yet. It does some things that Apple may not approve of, so it would have to be behind some sort of opt-in compiler flag at least. I was also considering support for other text input traits if there was the need. |
I'd love to see a package that extends this class with the fix for those who want to use it. Something like this package: https://github.com/onderceylan/cordova-plugin-wkwebview-inputfocusfix |
Fix for issue cjpearson#20
Hey guys, any updates on this, we have a hybrid app wrapped in cordova and we have a dark mode where we want to display a dark themed keyboard. what is the best way to do this at the moment ? |
@miguelyoobic95 i haven't seen any push on this, i believe cordova is sort of in maintenance mode at the moment. i'd recommend checking out https://capacitor.ionicframework.com/docs/apis/keyboard and possibly filing a ticket with them - it's like cordova, but all the code has been updated with swift and it is being actively developed. |
Hey guys (@ccorcos), I've made a package with this marvellous lines of code: http://github.com/gabrielribeiro/cordova-plugin-keyboard-appearance |
@gabrielribeiro thanks for your work ! |
Any chance we can add dark keyboard functionality to this plugin? This was in the original ionic plugin, but it's been commented out/not working for some time. https://github.com/driftyco/ionic-plugin-keyboard/blob/47518309fb18fd388527df495ddf9aea35a9fd77/src/ios/UIWebViewExtension.m#L65
This way we can have choice of keyboard color.
The text was updated successfully, but these errors were encountered: