import { ExpoConfig } from '@expo/config-types' ; import { createAndroidManifestPlugin } from '../plugins/android-plugins' ; import { AndroidManifest , getMainActivityOrThrow } from './Manifest' ; export const SCREEN_ORIENTATION_ATTRIBUTE = 'android:screenOrientation' ; export const withOrientation = createAndroidManifestPlugin ( setAndroidOrientation , 'withOrientation' ) ; export function getOrientation ( config ) { return typeof config . orientation === 'string' ? config . orientation : null ; } export function setAndroidOrientation ( config , androidManifest ) { const orientation = getOrientation ( config ) ; if ( ! orientation ) { return androidManifest ; } const mainActivity = getMainActivityOrThrow ( androidManifest ) ; mainActivity . $ [ SCREEN_ORIENTATION_ATTRIBUTE ] = orientation !== 'default' ? orientation : 'unspecified' ; return androidManifest ; }