useSafeArea.js 882 B

1
  1. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.checkIPhoneX=void 0,exports.getSafeAreaInset=getSafeAreaInset;var _useNativeAPI=require("./useNativeAPI");function getSafeAreaInset(){var e=["default","navBar"].includes(0<arguments.length&&void 0!==arguments[0]?arguments[0]:"default"),t={top:e?88:44,left:0,right:0,bottom:34};try{var o=(0,_useNativeAPI.getMenuButtonBoundingClientRectSync)(),a=(0,_useNativeAPI.getSystemInfoSync)(["window","device"]),r=a.safeArea,n=a.screenHeight,i=a.windowHeight,s=!!(a.system.toLowerCase().search("ios")+1),h=a.statusBarHeight||n-i-20,u=2*(o.top-h)+o.height,c=a.statusBarHeight&&s?4:0;t.top=e?h+u+c:Math.max(h,t.top),t.bottom=n-r.bottom}catch(e){}return t}var checkIPhoneX=exports.checkIPhoneX=function(e){var t=e.model,o=e.windowHeight,e=e.windowWidth;return/iphone (x|12|13|14)/.test(t.toLowerCase())||812<=o&&2<o/e};