Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable landscape mode in React Native Android dev mode?

I am new to android environment. I know iOS can be done in Xcode to disable device orientation. How can I disable landscape mode or any orientation mode in React Native Android?

Thanks.

like image 537
sungl Avatar asked Dec 03 '15 23:12

sungl


People also ask

How do I make my Android apps portrait only?

If you want to develop an application in portrait mode, add screenOrientation inside application tag. In the above result it is showing only portrait mode. now turn your device it not going to change the view according to orientation.

How do I turn off landscape mode in HTML?

In order to disable the landscape mode you need to add the following meta tag to your page header like so: Note: Please paste it at the top of your header. You can use the plugin call insert headers and footers to do so.


1 Answers

Add android:screenOrientation="portrait" to the activity section in android/app/src/main/AndroidManifest.xml file, so that it end up looking like this:

<activity     android:name=".Activity"     android:label="Activity"     android:screenOrientation="portrait"     android:configChanges="keyboardHidden|orientation|screenSize"> </activity> 

There are several different values for the android:screenOrientation property; for a comprehensive list take a look at the following: https://developer.android.com/guide/topics/manifest/activity-element.html

like image 141
Gem Ubaldo Avatar answered Sep 29 '22 03:09

Gem Ubaldo