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
A universal library for managing a device's screen orientation.
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.
Web has limited support.
Installation
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
Configurable properties
Are you using this library in an existing React Native app?
- Open the ios directory in Xcode with
xed ios. If you don't have the directory, runnpx expo prebuild -p iosto generate one. - Tick the
Requires Full Screencheckbox 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.
API
import * as ScreenOrientation from 'expo-screen-orientation';
No API data file found, sorry!