A keyboard is pressing on tabs and navigating through the app's contents in Ionic 3 on an Android device

I'm currently working on an IONIC 3 app and facing a challenge. When I tap on the ion search and the Keyboard pops up in ANDROID, it disrupts the layout by pushing all the content around.

Original screen:

Keyboard mode active:

Things I've tried so far:

In app.module.ts: scrollAssist: false,

autoFocusAssist: false,

and also: this.keyboard.disableScroll(true);

as well as: this.keyboard.disableScroll(false);

The behavior is normal on IOS devices

This issue occurs only on screens with TABS. On other screens, the keyboard works fine without pushing any content.

IONIC INFO:

cli packages:

@ionic/cli-utils  : 1.10.1
ionic (Ionic CLI) : 3.10.1

global packages:

Cordova CLI : 7.0.1 

local packages:

@ionic/app-scripts : 1.3.7
Cordova Platforms  : android 6.2.1 browser 4.1.0 ios 4.3.1
Ionic Framework    : ionic-angular 3.5.3

System:

ios-sim : 5.1.0 
Node    : v6.11.0
npm     : 3.10.10 
OS      : macOS Sierra
Xcode   : Xcode 8.3.3 Build version 8E3004b

My HTML:

<ion-header>

  <ion-navbar color = "festow-primary">
    <button ion-button menuToggle>
      <icon-icon name = "menu"></ion-icon>
    </button>
    <ion-title> Festas em {{cidadeCodigo}} </ion-title>
    <ion-buttons end>
      <button (click) = "modalPesquisa()" ion-button icon-only>
        <icon-icon name = "ios-funnel"></ion-icon>
      </button>
    </ion-buttons>
  </ion-navbar>

</ion-header>


<ion-content class = "teste">
  <ion-refresher (ionRefresh) = "doRefresh($event)">
    <ion-refresher-content
      pullingIcon = "arrow-dropdown"
      pullingText = "Pull to refresh"
      refreshingSpinner = "circles"
      refreshingText = "Refreshing...">
    </ion-refresher-content>
  </ion-refresher>
  <ion-searchbar *ngIf = "festa"
  placeholder = "Search..."
  [(ngModel)] = "myInput"
  (ionInput) = "onInput($event)">
</ion-searchbar>

  <ion-card *ngFor = "let festa of festas" class = "cards card-full" style = "border-color: #ffffff!important;">

    <img class = "card-image" src = "http://festow.com/images/{{festa.thumb}}" height = "42%" style = "border-color: #ffffff!important;">
    <ion-fab center edge class = "fab-cards">
        <button ion-fab mini class = "fab-button" (click) = "itemTapped($event, festa)"><icon-icon name = "add"></ion-icon></button>
      </ion-fab>
    <ion-card-content class = "card-content-grid-padding">
      <ion-grid class = "grid-padding">
        <ion-row>
          <ion-col col-6 col-sm>
            <p class = "p-cards fonte">{{festa.nome}}</p>
            <p class = "p-cards fonte">{{festa.horario}} - {{festa.hora_fim}}</p>
          </ion-col>
          <ion-col col-4 col-sm offset-2>
            <p class = "p-cards fonte">{{festa.nome_casa}}</p>
            <p class = "p-cards"><rating [score] = "festa.estrelas" max = "5"></rating></p>
          </ion-col>
        </ion-row>
      </ion-grid>
    </ion-card-content>

  </ion-card>
</ion-content>

My TS:

ngOnInit() {
    // this.keyboard.disableScroll(true);
    // this.keyboard.disableScroll(false);
      this.presentLoading();

      setTimeout(() => {
        this.festaService.loadFestas(this.cidadeCodigo).subscribe(
          data => {
            this.loader.dismiss();
            if (data['erro'] == false) {

              this.festa = data.festa;
              this.nomeFesta = data.festa.nome;
              console.log(data.festa);

              let alert = this.alertCtrl.create({
                title: 'Success!',
                subTitle: 'These are the parties happening today in' + this.cidadeCodigo + '.',
                buttons: [
                  {
                    text: 'OK',
                    handler: data => {
                    }
                  }
                ]
              });
              alert.present();
            } else {
              this.naotem = '1';
              let alert = this.alertCtrl.create({
                title: 'Success!',
                subTitle: 'No parties found today in' + this.cidadeCodigo + '.',
                buttons: [
                  {
                    text: 'OK',
                    handler: data => {
                    }
                  }
                ]
              });
              alert.present();
            }
          },
          err => {
            console.log(err);
          },
          () => console.log('parties loaded')
        );
      }, 2000);
    }

Answer №1

Why not give ion-grid a try in the following way? Let us know how it works out for you.

.html

<ion-content class = "test">
<ion-grid>
    <ion-row>
      <ion-col col-12>
       <ion-refresher (ionRefresh) = "doRefresh ($ event)">
       <ion-refresher-content
      pullingIcon = "arrow-down"
      pullingText = "Pull to refresh"
      refreshingSpinner = "circles"
      refreshingText = "Refreshing ...">
    </ ion-refresher-content>
  </ ion-refresher>
  <ion-searchbar *ngIf = "party"
  placeholder = "Search..."
  [(ngModel)] = "myInput"
  (ionInput) = "onInput ($ event)">
</ ion-searchbar>

  <ion-card *ngFor = "let party of parties" class = "cards card-full" style = "border-color: #ffffff! important;">

    <img class = "card-image" src = "http://example.com/images/{{party.thumb}}" height = "42%" style = "border-color: #ffffff! important;">
    <ion-fab center edge class = "fab-cards">
        <button ion-fab mini class = "fab-button" (click) = "itemTapped ($ event, party)"> <ion-icon name = "add"> </ ion-icon> </ button>
      </ ion-fab>
    <ion-card-content class = "card-content-color padding-grid">
      <ion-grid class = "padding-grid">
        <ion-row>
      <ion-col col-6 col-sm>
      <p class = "p-cards font"> {{party.name}} </ p>
      <p class = "p-cards font"> {{party.start_time}} - {{party.end_time}} </ p>
      </ ion-col>
      <ion-col col-4 col-sm offset-2>
      <p class = "p-cards font"> {{party.club_name}} </ p>
      <p class = "p-cards"> <rating [score] = "party.stars" max = "5"> < / rating> < / p>
      </ ion-col>
        </ ion-row>
      </ ion-grid>

    </ ion-card-content>

    </ ion-card>
   </ion-col>
  </ion-row>
 </ion-grid>
</ ion-content>

your-page.scss

page-my{
    .test {
       ion-grid {
            min-height: 100%;
        }
     }
 }

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What could be causing the issue with "class not being recognized as a constructor" error that I am encountering?

When attempting to create an instance from modules in routing, I consistently encountered the error message "class is not a constructor." Below is the code snippet: export class Modules{ modules : object = { masterdata : MasterdataModule, shop : ...

How to create classes in typescript without utilizing the class keyword

As someone new to TypeScript, I have a curious question about classes. In pre-ES6 JavaScript, there were no classes. So, naturally, one would think it's possible to avoid using them in TypeScript as well. However, I am struggling to figure out the c ...

Determine if any element includes the desired value by utilizing querySelectorAll

Currently, I am utilizing Karma/Jasmine to run tests on an Angular page to ensure that a ul element contains the specific text I am looking for. Since it is an unordered list (ul), I am not concerned about the order of the elements. However, at the moment, ...

React Testing Library - Screen debug feature yields results that may vary from what is displayed in the

Greetings to all who come across this message. I have developed a tic-tac-toe game in typescript & redux with a 3x3 grid, and now I am facing some challenges while trying to write unit tests for it. Consider the following game board layout where X represen ...

What factors contribute to TypeScript having varying generic function inference behaviors between arrow functions and regular functions?

Consider the TypeScript example below: function test<T = unknown>(options: { a: (c: T) => void, b: () => T }) {} test({ a: (c) => { c }, // c is number b: () => 123 }) test({ b: () => 123, a: (c) => { retur ...

Error: Request for resolution of all parameters for SignupComponent failed: ([object Object], ?). Occurred at the syntaxError in compiler.js:2175

Could someone assist me in resolving this issue? signup.component.html <main role="main" class="container> <h1 class="mt-5">&nbsp;</h1> <h5 class="mt-5 ">Create Account</h5> <br/> <div class="loa ...

Facing a problem with querying interfaces and types in TypeScript

My goal is to pass a variable to an RTK Query API service that uses a typescript interface: const device_id: unique symbol = Symbol(props.id); const { data: device, isFetching, isLoading, } = useGetAssetsByIdQuery(device_id, { pollingInterv ...

Communicating Progress Updates from C# to Angular 6 Using HttpPost

I'm building an Angular 6 application with a progress bar that displays the rendering and downloading progress of a PDF file as a percentage. Here's my Post call: renderReport(renderObjectId: number): Observable<HttpEvent<Blob>> { ...

Ways to usually connect forms in angular

I created a template form based on various guides, but they are not working as expected. I have defined two models: export class User { constructor(public userId?: UserId, public firstName?: String, public lastName?: String, ...

Cannot access a Typescript method variable within an inline function

I've encountered an issue with my code involving loading values into the array usageCategory within an inline function. Despite successfully adding values to the array inside the function, I am unable to print them outside it. getAllUsageCategoryElem ...

Why isn't Nodemon monitoring the directory in webpack-typescript-node.js?

Here are the contents of the package.json file for a TypeScript project using webpack and node.js: "scripts": { "build": "webpack", "dev:start": "nodemon --watch src --exec \"node -r dotenv/co ...

Issue: Debug Failure. Invalid expression: import= for internal module references should have been addressed in a previous transformer

While working on my Nest build script, I encountered the following error message: Error Debug Failure. False expression: import= for internal module references should be handled in an earlier transformer. I am having trouble comprehending what this erro ...

Issue with narrowing TypeScript arrays often encountered

When working with arrays of strings in my TypeScript code, I restrict the contents to certain letters by using a defined type like ("A" | "B")[] for letters such as A and B. However, when I have a function that takes an arbitrary array ...

Incorporating the id attribute into the FormControl element or its parent in Angular 7

I'm attempting to assign an id attribute to the first invalid form control upon form submission using Angular reactive forms. Here is my current component code: onSubmit() { if (this.form.invalid) { this.scrollToError(); } else { ...

Try out Playwright for testing Angular form controls

I'm currently examining a form control using the Playwright framework. The structure of the DOM is as follows: <div class="form-group"> <label for="usernameInput">User name</label> <input type="text" ...

Strategies for avoiding unused style tags in React components

Expanding beyond React, I'm unsure if React itself is the culprit of this issue. In a React environment with TypeScript, I utilize CSS imports in component files to have specific stylesheets for each component. I assumed these styles would only be ad ...

"Facing issue with behaviorSubject's next() method not functioning correctly in Angular

I've developed a HeaderComponent that showcases the header and includes a search bar. When a user types something in the search bar and hits enter, they are directed to the SearchComponent. My goal is to make sure that when a user is on the Search pa ...

Creating a versatile JavaScript/TypeScript library

My passion lies in creating small, user-friendly TypeScript libraries that can be easily shared among my projects and with the open-source community at large. However, one major obstacle stands in my way: Time and time again, I run into issues where an NP ...

Unable to append item to document object model

Within my component, I have a snippet of code: isLoaded($event) { console.log($event); this.visible = $event; console.log(this.visible); this.onClick(); } onClick() { this.listImage = this.imageService.getImage(); let span = docu ...

Transforming AngularJS 2.0 code into ES6 syntax

Successfully implemented the AngularJS 2.0 5 Minute Quickstart in my IntelliJ IDEA 14.1.4 following a helpful Stackoverflow Answer on AngularJS 2.0 TypeScript Intellij idea (or webstorm) - ES6 import syntax. However, it seems to focus on compiling TypeScr ...