UNPKG

1.51 kBSource Map (JSON)View Raw
1{"version":3,"file":"Orientation.js","sourceRoot":"","sources":["../../src/android/Orientation.ts"],"names":[],"mappings":";;AAGa,QAAA,4BAA4B,GAAG,2BAA2B,CAAC;AAExE,SAAgB,cAAc,CAAC,MAAkB;IAC/C,OAAO,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5E,CAAC;AAFD,wCAEC;AAEM,KAAK,UAAU,qBAAqB,CAAC,MAAkB,EAAE,gBAA0B;IACxF,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,gBAAgB,CAAC;KACzB;IAED,IAAI,YAAY,GAAG,gBAAgB,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CACzE,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,KAAK,eAAe,CACvD,CAAC;IACF,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,oCAA4B,CAAC,GAAG,WAAW,CAAC;IAEjE,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAZD,sDAYC","sourcesContent":["import { ExpoConfig } from '../Config.types';\nimport { Document } from './Manifest';\n\nexport const SCREEN_ORIENTATION_ATTRIBUTE = 'android:screenOrientation';\n\nexport function getOrientation(config: ExpoConfig) {\n return typeof config.orientation === 'string' ? config.orientation : null;\n}\n\nexport async function setAndroidOrientation(config: ExpoConfig, manifestDocument: Document) {\n const orientation = getOrientation(config);\n if (!orientation) {\n return manifestDocument;\n }\n\n let mainActivity = manifestDocument.manifest.application[0].activity.filter(\n (e: any) => e['$']['android:name'] === '.MainActivity'\n );\n mainActivity[0]['$'][SCREEN_ORIENTATION_ATTRIBUTE] = orientation;\n\n return manifestDocument;\n}\n"]}
\No newline at end of file