Expo Docs

Hey friend! We are co-hosting a conference with Software Mansion, learn more.

ScreenOrientation

Allows changing supported screen orientations at runtime. This will take priority over the orientation key in app.json.

Allow a screen orientation. You can call this function multiple times with multiple orientations to allow multiple orientations.

  • orientation (string) -- The allowed orientation. See the Orientation enum for possible values.

function changeScreenOrientation() {
  Expo.ScreenOrientation.allow(Expo.ScreenOrientation.Orientation.LANDSCAPE);
}

An object containing the values that can be passed to the allow function.
  • ALL -- All 4 possible orientations
  • ALL_BUT_UPSIDE_DOWN -- All but reverse portrait, could be all 4 orientations on certain Android devices.
  • PORTRAIT -- Portrait orientation, could also be reverse portrait on certain Android devices.
  • PORTRAIT_UP -- Upside portrait only.
  • PORTRAIT_DOWN -- Upside down portrait only.
  • LANDSCAPE -- Any landscape orientation.
  • LANDSCAPE_LEFT -- Left landscape only.
  • LANDSCAPE_RIGHT -- Right landscape only.

The best way to do this is to listen for changes to Dimensions.