Search code examples
cordovaionic-frameworkcordova-pluginsionic4ionic-native

How to add a button on top of keyboard on IONIC4


I've been trying to add a "SUBMIT" button on top of the keyboard using Ionic4 but no luck so far. Is that possible?

I'm using the Ionic Native Keyboard Plugin and I've added the <preference name="KeyboardResize" value="false" /> on my config.xml

This is what I have in the bottom of my html

<ion-footer>
    <ion-toolbar>
        <ion-button style="position: absolute; bottom: 0; right: 5px; z-index: 2;" expand="full" type="submit">Submit Review</ion-button>
    </ion-toolbar>
</ion-footer>

Also is there a way to make it so the keyboard can't be dismissed?

Thanks


Solution

  • Just for reference in case someone has the same issue, the solution is to import KeyboardResizeMode on the component you have your keyboard.

    import { Keyboard, KeyboardResizeMode } from '@ionic-native/keyboard/ngx';
    
    constructor(private keyboard: Keyboard) {}
    
    // On the ngOnInit()
    ngOnInit() {
       this.keyboard.setResizeMode(KeyboardResizeMode.Body);
    }
    

    You can't pass the setResizeMode as a string, even thou on the documentation says so, it needs to be as a property of KeyboardResizeMode.