Saturday, July 20, 2019

Disable Screen Rotation Landscape Mode in Android React Native

This tutorial explains how to disable screen rotation landscape mode in android react native application. There are two different types of orientation in android device, Portrait mode and Landscape modePortrait mode is default mode in mobile devices and if we rotate the device it turns into Landscape mode.But While making an application we normally design for the Portrait mode and let the system manage in Landscape mode (You can manage both) but in some cases, we don’t want the system to change the orientation while the user is using our App.
But in some case developer wants to disable the Landscape Mode screen rotation in android mobile device, in that case you need to follow the below steps in your react native project.

Disable Screen Rotation Landscape Mode in Android React Native


React Native Disable Screen Rotation

Lets see the below steps that helps to disable screen rotation landscape mode in android react native application. 

Step 1: Create a new react native project, if you don’t know how to create a new project in react native just follow this tutorial.

Step 2: Open <React_Native_Project> -> android -> app -> src -> main -> AndroidManifest.xml file.

Step 3: Find activity tag in AndroidManifest.xml and put android:screenOrientation="portrait" line inside it. Refer the below screenshot for reference.


Disable Screen Rotation Landscape Mode in Android React Native


Step 4: After making changes in AndroidManifest.xml file you need to run  react-native run-android command to see the effects. This would disable the landscape mode in your current application in android devices.

This is all about Disable Screen Rotation Landscape Mode in Android React Native. Thank you for reading this article, and if you have any problem, have a another better useful solution about this article, please write message in the comment section.


No comments:

Post a Comment