skip to Main Content

I want my react native app to support only portrait view . I have tried updating the android manifest but it does not seems to be working . When I disable the lock orientation mode on my device , my app turns into landscape mode .

I have tried updating the android manifest file using ,
android:screenOrientation="portrait"
But when I turn off the screen orientation lock on my device the app turns into landscape mode . Can anyone suggest a solution please .

2

Answers


  1. For android, android:screenOrientation="portrait" should work after you have rebuilt your project after making this change.

    For iOS, in Info.plist, use

    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
    </array>
    

    and then rebuild the project.

    Login or Signup to reply.
  2. You need to do it separately for Android and iOs. There’s a library to ReactNative to do it programatically but I assume you need to define it by default.

    As remember there’s screenOrientation attribute to portrait in AndroidManifest.xml file.

    <activity
        android:name=".MainActivity"
        android:screenOrientation="portrait"
        android:configChanges="orientation"
    </activity>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search