Giter Club home page Giter Club logo

Comments (11)

BerkeAras avatar BerkeAras commented on May 19, 2024 1

If you use capacitor or cordova the plugin ionic keyboard would stop pushing the content up

from panes.

Nickholas avatar Nickholas commented on May 19, 2024 1

Borried looking for a solution, i did this and works 100% on any device:

On .html:

<ion-item>
                    <ion-label position="floating">Días disponibles</ion-label>
                    <ion-input formControlName="dias" type="number" class="number-input" readonly='true' (ionFocus)="changeDiasDisponible()"></ion-input>
                </ion-item>

On .ts:

async changeDiasDisponible() {
    const alert = await this.alertController.create({
      header: 'Nº días disponibles',
      inputs: [
        {
          name: 'numdias',
          type: 'number',
          value: this.form.get('dias').value
        }
      ],
      buttons: [
        {
          text: 'Cancel',
          role: 'cancel',
          cssClass: 'secondary'
        }, {
          text: 'Ok',
          handler: (data: any) => {
            this.form.get('dias').patchValue(data.numdias);
          }
        }
      ]
    });
    await alert.present();
  }

from panes.

roman-rr avatar roman-rr commented on May 19, 2024

@eduboxgithub Please describe platform/browser/device

from panes.

eduboxgithub avatar eduboxgithub commented on May 19, 2024

Hello @BerkeAras and @roman-rr.

I'm using Capacitor (latest version) and I'm testing on a Android device.
Already tested on a OnePlus 5T with Android 10, a Wiko with Android 7 and a Xiaomi A2 with custom ROM (LineageOS).

In all of them when a pane is rendered with an ion-input, when the native keyboard shows up (ion-input focus) the pane scrolling breaks and cant be restored...

This only happens on a device... because of the native keyboard.

If I try to block the content to be pushed up... probably I will be writing things in the input, but not seeing what is being written...

from panes.

BerkeAras avatar BerkeAras commented on May 19, 2024

@eduboxgithub Is the bug happening when you dont use ion-input?

from panes.

roman-rr avatar roman-rr commented on May 19, 2024

@eduboxgithub please share your code and i will find optimal solution for this case.

from panes.

roman-rr avatar roman-rr commented on May 19, 2024

@eduboxgithub Reproduced in my environment, looking for solution.

from panes.

roman-rr avatar roman-rr commented on May 19, 2024

@eduboxgithub

Quick solution

if solve your issue, i will add to next release

if (this.platform.is('android')) {
  const pane = <HTMLElement>document.querySelector('.pane');
    window.addEventListener('keyboardWillHide', () => 
    window.requestAnimationFrame(() => (pane.style.display = 'none',
    window.requestAnimationFrame(() => pane.style.display = 'block'))));
}

More properly way

Manual mode control keyboard

ngOnInit() {
  let myPane = new CupertinoPane('ion-drawer', {
    parentElement: 'body'
  });
  myPane.present();

  let pane = <HTMLElement>document.querySelector('.pane');
  let initPos;
  window.addEventListener('keyboardWillShow', (e: any) => {
    initPos = this.getPaneTransformY();
    pane.style.transform = `translateY(${this.getPaneTransformY() - e.keyboardHeight}px) translateZ(0px)`;
  });
  window.addEventListener('keyboardWillHide', (e: any) => {
    pane.style.transform = `translateY(${initPos}px) translateZ(0px)`;
  });
}

getPaneTransformY = (): number => {
  const translateYRegex = /\.*translateY\((.*)px\)/i;
  return parseFloat(translateYRegex.exec((<any>document.querySelector('.pane')).style.transform)[1]);
}

For perfect experience you can additionally check that focused input contains in Pane element and check that bottom offset to focused input less than keyboard height.

from panes.

nbaleli-w avatar nbaleli-w commented on May 19, 2024

I wonder if this can be achieved in a browser as well?
I currently have an input in the drawer and the virtual keyboard is hiding it -/

from panes.

roman-rr avatar roman-rr commented on May 19, 2024

@nbaleli-w please describe your issue here #73
Seems like it's match.

from panes.

alleneben avatar alleneben commented on May 19, 2024

Hello, when I focus in an input on android, style="overflow: hidden" is injected into my pages html tag. This prevents me from scrolling the page.

How do I fix this.

from panes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.