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.

Locking to Portrait on app launching rotates from Landscape to Portrait (iOS)

See original GitHub issue

I want to lock the orientation of the first screen of app to Portrait. But when I launch the application I see for a while landscape orientation and then quickly rotating to the Portrait orientation. Next screens are okey.

Here is my code:

componentDidMount() {
        Orientation.lockToPortrait()
}

Is it possible to solve this performance issue?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

11reactions
wondaycommented, Dec 21, 2018

You also can add native code to AppDelegate.m

#import "Orientation.h"

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  // lock to Portrait
  [Orientation setOrientation:UIInterfaceOrientationMaskPortrait];
  [[UIDevice currentDevice] setValue:[NSNumber numberWithInteger: UIInterfaceOrientationPortrait] forKey:@"orientation"];

...
}
0reactions
ALPNPcommented, May 2, 2020

The native code solved my problem. This is amazing. I love this library.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change or lock the screen orientation on iPhone
You can lock the screen orientation so that it doesn't change when you rotate iPhone. Open Control Center, then tap the Lock Orientation...
Read more >
Locking to Portrait on app launching rotates from Landscape ...
But when I launch the application, I see landscape orientation for a while and then quickly rotating to portrait orientation. The next screens...
Read more >
Apple iPhone - Turn Screen Portrait Orientation Lock On / Off
Screen Portrait Orientation mode displays content in landscape (horizontal) or portrait (vertical) and isn't available for all apps. Simply turn your Apple® ...
Read more >
Make Your iPhone's Portrait Orientation Lock Change ...
Step 1Select a Trigger for Your Automation · Step 2Choose All the Apps You Want · Step 3Make It Work When Apps Open...
Read more >
iPhone Screen Not Rotating to Landscape Mode? Here's How ...
Here, tap on the Portrait Orientation Lock toggle (which looks like a lock with a circular arrow) to turn it on or off....
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