Open MobilityTiago opened 6 years ago
Dear @MobilityTiago Did you solve this issue?
I have two inputs in a form whereby one needs the decimal keyboard and the other the regular keyboard. I think I'll hit the same problem as you!
@mesqueeb in my fork of this repository I have added two functions with add/remove decimal character to be called on the focus/blur of the decimal fields.
I haven't synced in a while with this repository so be aware that you may not be able to just switch to my fork (it has some other minor differences because I needed to adapt it to our project).
Please check it out: https://github.com/MobilidadeBPI/cordova-plugin-decimal-keyboard
decimal-keyboard.js
DecimalKeyboard.addDecimalToKeyboard = function(successCallback, errorCallback){
exec(successCallback, errorCallback, "DecimalKeyboard", "addDecimalToKeyboard", []);
};
DecimalKeyboard.removeDecimalFromKeyboard = function(successCallback, errorCallback){
exec(successCallback, errorCallback, "DecimalKeyboard", "removeDecimalFromKeyboard", []);
};
CDVDecimalKeyboard.m
- (void) addDecimalToKeyboard:(CDVInvokedUrlCommand*)command {
if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11"))
{
[self processKeyboardShownEvent];
}
}
- (void) removeDecimalFromKeyboard:(CDVInvokedUrlCommand*)command {
if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11"))
{
if(decimalButton)
[self removeDecimalButton];
}
}
Seems that in iOS11 keyboard will appear/disappear notifications are no longer triggered while navigating fields (i.e. up/down arrows on accessory view), this makes navigating between a field with a decimal keyboard and one that needs the decimal button added not work properly.
I'm checking on a fix for the project I'm in where I'll expose a function to be called on the focus of fields when this plugin is used in iOS11 or above.