{"version":3,"file":"screen.mjs","sources":["../../src/platform/screen.ts"],"sourcesContent":["import { Dimensions } from \"react-native\"\n\nimport { RNv64Compat } from \"../react_native_v64_compat\"\n\nenum Orientation {\n  Portrait,\n  Landscape,\n}\n\nexport const isPortrait = () => getScreenHeight() >= getScreenWidth()\nexport const isLandscape = () => getScreenHeight() <= getScreenWidth()\n\nexport const getScreenHeight = () => getScreen().height\nexport const getScreenWidth = () => getScreen().width\nexport const getScreen = () => Dimensions.get(\"screen\")\n\nexport const onDimensionChange = (fn: (orientation: Orientation) => void) => {\n  const callback = () => fn(isPortrait() ? Orientation.Portrait : Orientation.Landscape)\n  const sub = Dimensions.addEventListener(\"change\", callback)\n\n  /* removeEventListener is deprecated but addEventListener does not return a\n   * subscription object in versions of React Native v0.64 or below. We can\n   * remove this condition when v64 (or below) is no longer supported.\n   */\n  return () =>\n    sub\n      ? sub.remove()\n      : (Dimensions as RNv64Compat<Dimensions>).removeEventListener(\"change\", callback)\n}\n"],"names":["isPortrait","getScreenHeight","getScreenWidth","getScreen","Dimensions","onDimensionChange","fn","callback","sub"],"mappings":";AASO,MAAMA,IAAa,MAAMC,EAAA,KAAqBC,EAAA,GAGxCD,IAAkB,MAAME,IAAY,QACpCD,IAAiB,MAAMC,IAAY,OACnCA,IAAY,MAAMC,EAAW,IAAI,QAAQ,GAEzCC,IAAoB,CAACC,MAA2C;AAC3E,QAAMC,IAAW,MAAMD;AAAA,IAAGN,EAAA,IAAe,IAAuB;AAAA;AAAA,EAAA,GAC1DQ,IAAMJ,EAAW,iBAAiB,UAAUG,CAAQ;AAM1D,SAAO,MACLC,IACIA,EAAI,OAAA,IACHJ,EAAuC,oBAAoB,UAAUG,CAAQ;AACtF;"}