View Full Version : [OPEN-122] Rotation issue with Ext.Viewport.scrollToTop and iPhone 3G

3 May 2011, 2:44 PM
I have a Sencha Touch app that displays fine in portrait orientation. When going to landscape, the screen splits in half, the tabBar gets detached, and content from another tab appears on the bottom half of the screen. This only happens on iPhone 3G; tests fine on Android and iPad. See screenshots attached.

5 May 2011, 11:27 PM
I am experiencing the same bug. When I rotate my apps that use a TabPanel as the main viewport/shell the tabbar appears half way up the screen as in the images above. If I load the app in landscape than everything looks right.

I have posted this issue before but no one could help. This must be a bug.

6 May 2011, 11:01 AM
After hours of trying everything.

This seems to fix the problem for me...

Ext.Viewport.scrollToTop = function(){
window.scrollTo(0, 1);

...it is originally defined as

function () {
if (Ext.is.iOS) {
document.body.scrollTop = document.body.scrollHeight;
else {
window.scrollTo(0, 1);

19 May 2011, 6:01 PM
I'm seeing the same issue. Where did you put that code? In the TabPanel? Or elsewhere?


19 May 2011, 11:22 PM
At the top of my index.js file.

20 May 2011, 4:49 AM
Thanks much Simon. That worked for me too!

22 May 2011, 6:16 AM
Fixed it here as well.
Thanks for sharing.

23 May 2011, 9:39 AM
That worked, thanks.
I tried setting the coordinates to 0, 0 to remove the row of white pixels at the bottom of the screen in landscape mode. This worked on iOS, but for some reason on Android, it made the address bar persist.
At this point the white line is the lesser of evils.
Thanks again.

31 May 2011, 5:59 AM
Yes, this helped me also, had this issue for days now. This fixed it.

12 Apr 2012, 8:51 AM
I have the same problem in my app, Im using Sencha Touch 2, Im kind of noob at this: should I put this code on my app.js file? Cause I don't see any index.js, or is it in the SDK? Thanks a lot!