Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native landscape mode for only one page

Tags:

react-native

Is it possible in react native to have the app run in portrait mode but have one page run in landscape mode? I know in xcode you have to select portrait or landscape at the beginning so I am a little confused as to how to make all pages in the app portrait except one.

like image 863
Adam Katz Avatar asked Oct 25 '16 08:10

Adam Katz


People also ask

How do I change the orientation of a specific screen in react native?

Screen orientation lock​ For Android, open the AndroidManifest. xml file and within the activity element add 'android:screenOrientation="portrait"' to lock to portrait or 'android:screenOrientation="landscape"' to lock to landscape.

How do I change the orientation of Android manifest?

The screen orientation attribute is provided by the activity element in the Android Manifest. Xml file. The orientations provided by the activity are Portrait, Landscape, Sensor, Unspecified and so on. To perform a screen orientation activity you define the properties in the Android Manifest.


1 Answers

In react navigation v6 u can do this:

  <AppStack.Screen
    name="VehiclesDetailsAuction"
    component={VehiclesDetailsAuction}
    options={{ orientation: 'portrait' }}
  />
  <AppStack.Screen
    name="VehicleImageView"
    component={VehicleImageView}
    options={{ orientation: 'all' }}
  />
like image 179
Ajmal Hasan Avatar answered Sep 21 '22 12:09

Ajmal Hasan