FIX: Apply Visual Viewport composer height calc in iOS only

This commit is contained in:
Penar Musaraj 2019-10-02 13:37:41 -04:00
parent d0390fba3e
commit ea4e9dba8e
1 changed files with 6 additions and 2 deletions

View File

@ -132,12 +132,16 @@ export default Ember.Component.extend(KeyEnterEscape, {
$document.on(END_EVENTS, endDrag);
});
if (window.visualViewport !== undefined) {
if (this.shouldUseVisualViewportListener()) {
this.viewportResize();
window.visualViewport.addEventListener("resize", this.viewportResize);
}
},
shouldUseVisualViewportListener() {
return this.capabilities.isIOS && window.visualViewport !== undefined;
},
viewportResize() {
const composerVH = window.visualViewport.height * 0.01;
@ -174,7 +178,7 @@ export default Ember.Component.extend(KeyEnterEscape, {
willDestroyElement() {
this._super(...arguments);
this.appEvents.off("composer:resize", this, this.resize);
if (window.visualViewport !== undefined) {
if (this.shouldUseVisualViewportListener()) {
window.visualViewport.removeEventListener("resize", this.viewportResize);
}
},