@@ -57,3 +57,55 @@ log.apply(console, ['%cDeckDeckGo', 'color: #3880ff;font-size:2rem;font-weight:
5757log . apply ( console , [ '%cHey there, interested by our code? Lucky you, we are open source :)' , 'color: black;font-size:1rem;font-weight: 300;' ] ) ;
5858log . apply ( console , [ '%cCome say hi and contribute to our project on Github' , 'color: black;font-size:1rem;font-weight: 300;' ] ) ;
5959log . apply ( console , [ '%chttps://github.com/deckgo/deckdeckgo' , 'font-size:1rem;font-weight: 300;' ] ) ;
60+
61+
62+ // https://github.com/deckgo/deckdeckgo/issues/327
63+ // https://github.com/ionic-team/ionic/issues/19065
64+
65+ const hack = ( ) => {
66+ const ionApp = document . querySelector ( 'ion-app' ) ;
67+
68+ if ( ionApp ) {
69+ window . requestAnimationFrame ( ( ) => {
70+ ionApp . style . height = '100%' ;
71+ window . requestAnimationFrame ( ( ) => {
72+ ionApp . style . height = '' ;
73+ } ) ;
74+ } ) ;
75+ }
76+ } ;
77+
78+ let resizerObserver ;
79+
80+ document . addEventListener ( 'DOMContentLoaded' , ( ) => {
81+ if ( ! window ) {
82+ return ;
83+ }
84+
85+ if ( 'ResizeObserver' in window ) {
86+ const ResizeObserver = ( window as any ) . ResizeObserver ;
87+ resizerObserver = new ResizeObserver ( hack ) ;
88+ resizerObserver . observe ( document . documentElement ) ;
89+ } else {
90+ window . addEventListener ( 'keyboardWillShow' , hack ) ;
91+ window . addEventListener ( 'keyboardWillHide' , hack ) ;
92+ window . addEventListener ( 'resize' , hack ) ;
93+ }
94+ } ) ;
95+
96+ window . addEventListener ( 'unload' , ( ) => {
97+ if ( ! window ) {
98+ return ;
99+ }
100+
101+ if ( 'ResizeObserver' in window ) {
102+ if ( resizerObserver ) {
103+ resizerObserver . unobserve ( document . documentElement ) ;
104+ resizerObserver . disconnect ( ) ;
105+ }
106+ } else {
107+ window . removeEventListener ( 'keyboardWillShow' , hack ) ;
108+ window . removeEventListener ( 'keyboardWillHide' , hack ) ;
109+ window . removeEventListener ( 'resize' , hack ) ;
110+ }
111+ } ) ;
0 commit comments