You have an app that doesn’t look good in landscape mode or for some other reasons you don’t want to support that. Don’t worry, there is a way to totally disable that mode for your app, and fortunately, it’s a very little change.
To make your app only support portrait mode, you have to follow different instructions for each platform.
First, you need to open your project and find the AndroidManifest.xml file in this folder android > app > src > main
Then, edit the following activity element and add the android:screenOrientation=”portrait” to it.
IOS made it even easier, all you need to do can be done from Xcode, as you can see in the picture below.
- Open ios > [Project-Name].xcodeproj file in Xcode.
- click on the project name
- Then find General (tab) > Deployment Info (section) > device orientation
- check the Portrait mode
- uncheck Landspace Left and Landscape Right
That was all you needed to do, now you can build and run the project to see that the landscape is disabled and the screen won’t rotate when you are inside the app.