Comments (11)
If you use capacitor or cordova the plugin ionic keyboard would stop pushing the content up
from panes.
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.
@eduboxgithub Please describe platform/browser/device
from panes.
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.
@eduboxgithub Is the bug happening when you dont use ion-input
?
from panes.
@eduboxgithub please share your code and i will find optimal solution for this case.
from panes.
@eduboxgithub Reproduced in my environment, looking for solution.
from panes.
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.
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.
@nbaleli-w please describe your issue here #73
Seems like it's match.
from panes.
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)
- [BUG] Incorrect processing of removing focus from input HOT 1
- [BUG] Swiperjs within pane HOT 2
- [FEAT] Playground app
- [FEAT] Modal
- [FEAT] Sounds haptics
- [FEAT] Improve touch gestures
- [BUG] Keyboard reset breakpoints to default HOT 1
- [BUG] Ionic apps required await for componentOnReady() before set event listeners HOT 9
- [BUG] Textarea with Keyboard
- [BUG] overflow-y stop working when switching pages HOT 10
- [FEAT] Update changelog & Add husky to project HOT 3
- [FEAT] Add husky to project
- [BUG] ion-select-options appear behind the pane, select itself doesnt. HOT 3
- [BUG] z-Index issue or request to set it manually. HOT 2
- [FEAT] Close all panes on hardware back button event HOT 2
- [BUG] modal appears and overlaps screen if parentElement is gone HOT 1
- [BUG] fitHeight not set height HOT 6
- [FEAT]
- [BUG] calcFitHeight need some time to calc correctly HOT 1
- [BUG] Panes cannot be dragged in Chrome HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from panes.