i ran into the same problem when working with sencha touch 2 application and because, like ExtJS , I have a solution for you
this is probably an error in the structure, and this happens when ExtJS displays the application before the browser fills in the correct values ββfor window.innerWidth and window.innerHeight , and therefore the viewport cannot take the correct width and height. it also explains the randomness of the event. This becomes more noticeable when used on mobile phones, probably due to limited resources and a slow response.
the solution that I took to handle this mayba is not good, but I could not find a better one, given that this is a failure in the structure itself
i polling for the correct height and width browsers for about a second after every 100 ms for the correct height and width of the window, and if I find that the height or width of the viewport not the same, adjust it. because you work with ExtJS, and the application will run on high-power systems (compared to mobile phones), I would recommend a shorter interval and then be safe for the longer period of time for which it polled. heres the code I'm currently using to suit your needs
var aId = setInterval(function () { if (Ext.Viewport.getWidth() !== window.innerWidth || Ext.Viewport.getHeight() !== window.innerHeight) { Ext.Viewport.setSize(window.innerWidth, window.innerHeight); clearInterval(aId); } num = num + 1; if (num > 10) { clearInterval(aId); } }, 100)
I am currently using this code inside the launch function application. but you can also use this inside the show viewport event, for which you should keep a minimum time to avoid any delays.
with this, if you think that this application can be used on devices where the user can change the size and width of the window (for example, a mobile browser when changing orientation or if you think that the user will change the height and width browser window). then just copy and paste the same code snippet inside the resize event viewports so that it also polls and resizes the viewport when resizing the viewport.
source share