Search code examples
javascriptandroidcordovastatusbar

Cordova StatusBar Plugin Keyboard overlapping


I installed this package : https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-statusbar/

to hide statusbar on android.

I am using this command : StatusBar.hide(); in first page's deviceReady event.

It works well, but when i try to focus some inputs, soft keyboard overlaps on input.

If i remove hide command from my js, there is no problem.

Is this a bug ?

edit :

  • I tried to change fullscreen preference to false in config.xml
  • I tried to change android:windowSoftInputMode="adjustResize" to android:windowSoftInputMode="adjustPan" in AndroidManifest.xml.

edit 2 :

I want to hide on IOS too. But i tried for android.


Solution

  • Try adding these preferences in your config.xml

    <preference name="android-windowSoftInputMode" value="adjustResize" />
    <preference name="fullscreen" value="false" />
    

    edit :

    Another way you can try

    cordova plugin add cordova-plugin-keyboard
    

    after that add show listener to it.

    window.addEventListener('keyboardDidShow', function () {
        // Describe your logic which will be run each time keyboard is shown.
        setTimeout(function() {
          document.activeElement.scrollIntoViewIfNeeded();
        }, 100);
    });
    

    note :- Tested in chrome and safari