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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With