Stop pushing the page to top of the screen when opens the keyboard

My ionic page is pushing to the top and squeezing when the keyboard opens. I tried below code snippet and it didn’t work.

 ionViewDidEnter() {
        this.platform.ready().then(() => {
            this.keyboard.disableScroll(true);
        });
    }

IonicModule.forRoot({scrollAssist: false}),

Below is my ionic info.

Ionic:

Ionic CLI : 5.4.13 (C:\Users\sr\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 4.11.10
@angular-devkit/build-angular : 0.801.3
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.1.2

Cordova:

Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 4 other plugins)

Ionic keyboard version:

"@ionic-native/keyboard": "^5.21.5",

Anyone can help please?

This is how it works. When the keyboard opens, the WebView underneath adjusts to fit the new size. If it did not do that, then the WebView would be obscured by the keyboard.

For Android, you can configure this by setting an option in the Android build configuration. See this Stack overflow answer for more details.

Thank you for your reply. I tried to add that activity inside the AndroidManifest.xml as suggested in that stack-overflow answer. But still the same. Keyboard push the page to the top of the screen. I want to avoid it.

Hello,
If you are using ionic 4+
for ios:
add

<preference name="KeyboardResizeMode" value="ionic" />

in your config.xml

for android:
here

Hope it will help.