question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Screen Orientation Bug

See original GitHub issue

Short description of the problem:

WebView is resized to incorrect size after orientation change

What behavior are you expecting?

Expected app to cover entire width of the screen, but the web app (i.e. the WebView) is narrower than the complete width

The problem is that once the device is in landscape mode and the app is started. When programmatically setting the orientation to portrait, it INTERMITTENTLY fails

Steps to reproduce:

  • ionic start myApp tabs
  • cd myApp
  • cordova platform add ios@4.2.0
  • cordova plugin add cordova-plugin-screen-orientation
  • vim config.xml # add
<preference name="Orientation" value="all" />
  • vim www/js/app.js # add in the ready callback
screen.lockOrientation('portrait'); 
  • ionic build ios
  • Build and run from Xcode

I ran on iPad mini (iPad2,5) with iOS 9.3

Other information:

Couldn’t reproduce the problem with a vanilla Cordova app

Which Ionic Version? 1.3.1

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
fmardinicommented, Jul 14, 2016

I tracked this down. cordova-ios sets autoresizesSubviews to true and the screen orientation plugin presents a view controller after forcing orientation (I’m assuming to solve some corner case). This seems to cause a race condition where two resizes trigger at the same time and we end up with the width incorrectly set. When using the plugin the autoresizesSubviews should be set to false in the app delegate

2reactions
lambrospetroucommented, Jul 26, 2016

Actually, it’s not a Cordova problem. It is a conflict between Cordova and a plugin used by Ionic’s project. So it should be fixed by Ionic bundle since the starter app has the problem 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

iOS 16 auto-rotate bugged, content appears in top half of screen
Many iOS 16 users are facing an auto-rotate bug where content appears only in top half of lock screen when in landscape mode....
Read more >
iOS 16 unexpected rotation behaviour - Apple Developer
Then if we dismiss/pop back to Master screen, the app again unexpectedly rotates from Portrait to Landscape with no animations. Looks like a...
Read more >
How to fix iPad iMessage screen rotation problem ... - iKream
First solution: Clear all background apps to fix screen rotation bug on your iPad. It's possible that your iPad or iMessage gets stuck...
Read more >
How to Fix Auto Rotate Not Working on Android
Fix Auto-Rotate Issues by Restarting Your Android Phone · Turn On Screen Rotation From Android Settings · Use the In-App Screen Rotation Option....
Read more >
7 ways to fix Android screen rotation not working - Carlcare
7 ways to fix Android screen rotation not working · Restart your phone · Check Auto-rotation settings · Calibrate phone's sensors · Check...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found