Navigating to new screen and lockToLandscape() immediatelly doesn't rotate on iOS
See original GitHub issueWhen using react-navigation 6, navigating to a screen and having this code doesn’t rotate screen.
useEffect(() => {
Orientation.lockToLandscape()
}, [])
It only works with timeout over 500 (in my case).
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Rotate the screen on your iPhone or iPod touch - Apple Support
Tap the Portrait Orientation Lock button to make sure that it's off. Turn your iPhone sideways. If the screen still doesn't rotate, try...
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 >iPhone or iPad Screen Won't Rotate? Here's How to Fix It
Step 1. Turn Off Rotation Lock in the Control Center · Step 2. Try Rotating the Screen in a Different App · Step...
Read more >Android - Emulator in landscape mode, screen does not rotate
That was my problem too, I feel like a dummy. I'm new to Android (used iOS for years) and have realized that auto-rotate...
Read more >Make Your iPhone's Portrait Orientation Lock Change ...
I always keep my iPhone's Portrait Orientation Lock on so that my screen doesn't randomly rotate while I'm lying down.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Not any of the solutions listed above worked for me on iOS 13, 14 and 15.
For now I solved the problem by adding setTimeout to lock the screen orientation.
On Android, the app automatically locks into the landscape mode so I put the timeout as 0. On iOS, tweak the timeout between 600 to 1000 as per your need, it will automatically rotate the app in landscape mode (It will work for switching from landscape to portrait too).
This will work as expected.
Thank you!
adding
shouldAutoRotatefixed my problem