【问题标题】:On-screen keyboard covers fixed position input in ionic屏幕键盘涵盖离子中的固定位置输入
【发布时间】:2018-12-08 07:52:19
【问题描述】:
【问题讨论】:
标签:
ios
css
angular
ionic-framework
【解决方案1】:
我在使用 ion-textarea 时遇到了这个问题。我正在使用 ionic 4 beta 17 - 离子键盘 2.1.3
我仍然没有使用本机键盘,但也许会尝试。
我所做的是连接keyboardDidShow 事件并将活动文档滚动到视图中。看这段代码:
ngOnInit() {
window.addEventListener('keyboardDidShow', () => {
const el = document.getElementById('myElement');
//myElement would be the input you have. Or you can just scroll into view the active element, like
// document.activeElement.scrollIntoView();
if (document.activeElement === el)
el.scrollIntoView();
});
}