0

I am developing a React Native App for iOS and Android using wix/react-native-navigation.

I am using

  • react-native@0.55.4
  • react-native-navigation@^1.1.478

While researching how to force an Android App into portrait mode I found tons of answers basically saying either of these two options is the way to go:

  1. Adjust the manifest file:
<activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="orientation|screenSize"
    android:windowSoftInputMode="adjustResize" 
    android:screenOrientation="portrait">
  1. Set the orientation programmatically in the MainActivity.java:
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}

But neither has worked for me.

jneuendorf
  • 402
  • 6
  • 18

1 Answers1

0

For the used version of RNN the docs state that a tab-based app appStyle can contain orientation: "portrait" so I just tried it out for my single screen app and it worked!

import {Navigation} from "react-native-navigation"

Navigation.startSingleScreenApp({
    appStyle: {
        orientation: "portrait",
    },
    screen: {
        // ...
    },
    passProps: {},
    animationType: "fade",
})
jneuendorf
  • 402
  • 6
  • 18