mrchandoo / cordova-plugin-decimal-keyboard

Cordova plugin to show decimal keyboard on iPhones
Apache License 2.0
37 stars 71 forks source link

iOS 11 Compatibility #13

Open MobilityTiago opened 6 years ago

MobilityTiago commented 6 years ago

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.

mesqueeb commented 5 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!

MobilityTiago commented 5 years ago

@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];
    }
}