React Native landscape mode for only one page

In react navigation v6 you can do this:

  <AppStack.Screen
    name="VehiclesDetailsAuction"
    component={VehiclesDetailsAuction}
    options={{ orientation: 'portrait' }}
  />
  <AppStack.Screen
    name="VehicleImageView"
    component={VehicleImageView}
    options={{ orientation: 'all' }}
  />

There is a very well built package : react-native-orientation

The only downside is that you'll need to specify in every scene of your app the orientation with :

Orientation.lockToPortrait();

or

Orientation.lockToLandscape();

Tags:

React Native