Vitor Albres
Vitor Albres

Reputation: 123

How to disable app rotation in react-native ios without xcode?

I know that is possible to disable the rotation using XCode, but I do not have access to some Mac in the moment, then I wonder if there is a way to do that using VSCode, and not XCode.

Upvotes: 0

Views: 994

Answers (2)

Akshay Rao
Akshay Rao

Reputation: 3544

You can easily achieve this without xcode, you just have to update the key UISupportedInterfaceOrientations in your projects Info.plist file. Although you won't be able to test it without xcode.

You can search for the key UISupportedInterfaceOrientations in your projects Info.plist file and update the values as below. If you don't see any such key then simply create a new key and values as below:-

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

This would set the orientation on ios enabled as Portrait, Landscape Right and Landscape Left. If you only want it to Portrait just paste the code below:-

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

Upvotes: 3

Rupesh Chaudhari
Rupesh Chaudhari

Reputation: 308

You can simply change the orientation property in your App.json

"orientation": "portrait" or
"orientation": "landscape"

Upvotes: -1

Related Questions