typescriptnativescriptiqkeyboardmanager

Set lastTextFieldReturnKeyType with nativescript-IQKeyboardManager


I want to set the lastTextFieldReturnKeyType to DONE. I think I have to use IQKeyboardReturnKeyHandler, but I don't know how in Angular/typescript. Does anyone have any experience with this? I was unable to find it in https://github.com/tjvantoll/nativescript-IQKeyboardManager


Solution

  • Here is how you would do it with TypeScript.

    declare var UIReturnKeyType, IQKeyboardReturnKeyHandler;
    
    // Inside page loaded event
    const returnKeyHandler = new IQKeyboardReturnKeyHandler(page.ios);
    returnKeyHandler.lastTextFieldReturnKeyType = UIReturnKeyType.Done;
    (<any>page)._returnKeyHandler = returnKeyHandler;
    

    Incase of Angular, you may inject the Page in the constructor and use the same loaded event.