Skip to content

Ionic 2 screen height dynamically changes while showing keyboard on device  #5933

Closed
@fedorinoGore

Description

@fedorinoGore

Short description of the problem:

I accidentally discovered that screen vertical size changes after I'm clicking an input field in a from and device keyboard appears. After I closing keyboard - the height is still bigger than needed (and bigger than it was before) and I could scroll in vertical direction far beyond the visible area.

What behavior are you expecting?

It looks like that framework adds some height to the to make sure that keyboard will not overflow UI controls. But after hiding keyboard it should return to normal height, I believe...

Steps to reproduce:

  1. Create a form inside a
  2. Add some fileds
  3. Run on the device and tap on input field.
  4. Tap somewhere else to change focus
  5. Scroll in vertical direction to see that screen size dramatically changed...
<ion-content *ngIf="!auth.authenticated()" scroll="false">

    <div padding>
        <ion-segment [(ngModel)]="authType">
            <ion-segment-button value="login">
                Вход
            </ion-segment-button>
            <ion-segment-button value="signup">
                Регистрация
            </ion-segment-button>
        </ion-segment>
    </div>

    <div [ngSwitch]="authType">
        <form *ngSwitchWhen="'login'" #loginCreds="ngForm" (ngSubmit)="login(loginCreds.value)">
            <ion-item>
                <ion-label floating>Email</ion-label>
                <ion-input type="email" [(ng-model)]='user.username' value="{{user.username}}"></ion-input>
            </ion-item>
            <ion-item>
                <ion-label floating>Пароль</ion-label>
                <ion-input type="password"></ion-input>
            </ion-item>
            <div padding>
                <button block>Войти</button>
            </div>
        </form>

        <!--Or we could switch to register New user form-->
        <form *ngSwitchWhen="'signup'" #signupCreds="ngForm" (ngSubmit)="signup(signupCreds.value)">
            <ion-item>
                <ion-label floating>Email</ion-label>
                <ion-input type="email" ngControl="username"></ion-input>
            </ion-item>

            <ion-item>
                <ion-label floating>Пароль</ion-label>
                <ion-input type="password" ngControl="password"></ion-input>
            </ion-item>

            <ion-item>
                <ion-label floating>Повторите пароль</ion-label>
                <ion-input type="password" ngControl="repeatPassword"></ion-input>
            </ion-item>

            <div padding>
                <button block type="submit">Зарегистрироваться</button>
            </div>

        </form>
    </div>
    <!-- end of ngSwitch directive-->

</ion-content>

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)
https://forum.ionicframework.com/t/ionic-2-ion-content-height-dynamically-changes-while-showing-keyboard-on-device/46360

Which Ionic Version? 2.x

Run ionic info from terminal/cmd prompt: (paste output below)
Cordova CLI: 6.0.0
Gulp version: CLI version 1.2.1
Gulp local: Local version 3.9.1
Ionic Version: 2.0.0-beta.3
Ionic CLI Version: 2.0.0-beta.19
Ionic App Lib Version: 2.0.0-beta.9
ios-deploy version: Not installed
ios-sim version: 5.0.6
OS: Mac OS X El Capitan
Node Version: v5.7.1
Xcode version: Xcode 7.3 Build version 7D175

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions