This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.

Expo ScreenOrientation iconExpo ScreenOrientation

A universal library for managing a device's screen orientation.

Android
iOS
Web
Included in Expo Go
Recommended version:
~56.0.5

Screen Orientation is defined as the orientation in which graphics are painted on the device. For example, the figure below has a device in a vertical and horizontal physical orientation, but a portrait screen orientation. For physical device orientation, see the orientation section of Device Motion.

On both Android and iOS platforms, changes to the screen orientation will override any system settings or user preferences. On Android, it is possible to change the screen orientation while taking the user's preferred orientation into account. On iOS, user and system settings are not accessible by the application and any changes to the screen orientation will override existing settings.

Installation

Terminal
- npx expo install expo-screen-orientation
- yarn expo install expo-screen-orientation
- pnpm expo install expo-screen-orientation
- bun expo install expo-screen-orientation

If you are installing this in an existing React Native app, make sure to install expo in your project.

Warning

Apple added support for split view mode to iPads in iOS 9. This changed how the screen orientation is handled by the system. To put the matter shortly, for iOS, your iPad is always in landscape mode unless you open two applications side by side. To be able to lock screen orientation using this module you will need to disable support for this feature. For more information about the split view mode, check out the official Apple documentation.

Configuration in app config

You can configure expo-screen-orientation using its built-in config plugin if you use config plugins in your project (Continuous Native Generation (CNG)). The plugin allows you to configure various properties that cannot be set at runtime and require building a new app binary to take effect. If your app does not use CNG, then you'll need to manually configure the library.

Example app.json with config plugin

app.json
{ "expo": { "ios": { "requireFullScreen": true }, "plugins": [ [ "expo-screen-orientation", { "initialOrientation": "DEFAULT" } ] ] } }

Configurable properties

NameDefaultDescription
initialOrientationundefined
Only for: 
iOS

Sets the iOS initial screen orientation. Possible values: DEFAULT, ALL, PORTRAIT, PORTRAIT_UP, PORTRAIT_DOWN, LANDSCAPE, LANDSCAPE_LEFT, LANDSCAPE_RIGHT

Are you using this library in an existing React Native app?
  1. Open the ios directory in Xcode with xed ios. If you don't have the directory, run npx expo prebuild -p ios to generate one.
  2. Tick the Requires Full Screen checkbox in Xcode. It should be located under Project Target > General > Deployment Info.

Per-screen orientation with Expo Router

If you use Expo Router, you can set the orientation per screen using the orientation option on Stack.Screen. This is powered by react-native-screens and is the recommended approach for per-screen orientation in stack navigators.

src/app/_layout.tsx
import { Stack } from 'expo-router'; export default function Layout() { return ( <Stack> <Stack.Screen name="index" options={{ orientation: 'portrait' }} /> <Stack.Screen name="landscape" options={{ orientation: 'landscape' }} /> </Stack> ); }

API

import * as ScreenOrientation from 'expo-screen-orientation';

No API data file found, sorry!