1 line
1.8 KiB
Plaintext
1 line
1.8 KiB
Plaintext
{"version":3,"file":"Orientation.js","sourceRoot":"","sources":["../../src/android/Orientation.ts"],"names":[],"mappings":";;AAEA,gEAAyE;AACzE,yCAAqE;AAExD,QAAA,4BAA4B,GAAG,2BAA2B,CAAC;AAE3D,QAAA,eAAe,GAAG,6CAA2B,CACxD,qBAAqB,EACrB,iBAAiB,CAClB,CAAC;AAEF,SAAgB,cAAc,CAAC,MAAuC;IACpE,OAAO,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5E,CAAC;AAFD,wCAEC;AAED,SAAgB,qBAAqB,CACnC,MAAuC,EACvC,eAAgC;IAEhC,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAC3C,4FAA4F;IAC5F,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,eAAe,CAAC;KACxB;IAED,MAAM,YAAY,GAAG,iCAAsB,CAAC,eAAe,CAAC,CAAC;IAE7D,YAAY,CAAC,CAAC,CAAC,oCAA4B,CAAC;QAC1C,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC;IAE1D,OAAO,eAAe,CAAC;AACzB,CAAC;AAhBD,sDAgBC","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createAndroidManifestPlugin } from '../plugins/android-plugins';\nimport { AndroidManifest, getMainActivityOrThrow } from './Manifest';\n\nexport const SCREEN_ORIENTATION_ATTRIBUTE = 'android:screenOrientation';\n\nexport const withOrientation = createAndroidManifestPlugin(\n setAndroidOrientation,\n 'withOrientation'\n);\n\nexport function getOrientation(config: Pick<ExpoConfig, 'orientation'>) {\n return typeof config.orientation === 'string' ? config.orientation : null;\n}\n\nexport function setAndroidOrientation(\n config: Pick<ExpoConfig, 'orientation'>,\n androidManifest: AndroidManifest\n) {\n const orientation = getOrientation(config);\n // TODO: Remove this if we decide to remove any orientation configuration when not specified\n if (!orientation) {\n return androidManifest;\n }\n\n const mainActivity = getMainActivityOrThrow(androidManifest);\n\n mainActivity.$[SCREEN_ORIENTATION_ATTRIBUTE] =\n orientation !== 'default' ? orientation : 'unspecified';\n\n return androidManifest;\n}\n"]} |