ffd5dbd382e8a76bdd174c9ecd0d36d7.json
4.63 KB
{"ast":null,"code":"var _interopRequireDefault=require(\"@babel/runtime/helpers/interopRequireDefault\");Object.defineProperty(exports,\"__esModule\",{value:true});exports.default=_default;exports.isOrientationLandscape=void 0;var _extends2=_interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));var _classCallCheck2=_interopRequireDefault(require(\"@babel/runtime/helpers/classCallCheck\"));var _createClass2=_interopRequireDefault(require(\"@babel/runtime/helpers/createClass\"));var _possibleConstructorReturn2=_interopRequireDefault(require(\"@babel/runtime/helpers/possibleConstructorReturn\"));var _getPrototypeOf2=_interopRequireDefault(require(\"@babel/runtime/helpers/getPrototypeOf\"));var _inherits2=_interopRequireDefault(require(\"@babel/runtime/helpers/inherits\"));var _react=_interopRequireDefault(require(\"react\"));var _Dimensions=_interopRequireDefault(require(\"react-native-web/dist/exports/Dimensions\"));var _hoistNonReactStatics=_interopRequireDefault(require(\"hoist-non-react-statics\"));var isOrientationLandscape=function isOrientationLandscape(_ref){var width=_ref.width,height=_ref.height;return width>height;};exports.isOrientationLandscape=isOrientationLandscape;function _default(WrappedComponent){var withOrientation=function(_React$Component){(0,_inherits2.default)(withOrientation,_React$Component);function withOrientation(){var _this;(0,_classCallCheck2.default)(this,withOrientation);_this=(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(withOrientation).call(this));_this.handleOrientationChange=function(_ref2){var window=_ref2.window;var isLandscape=isOrientationLandscape(window);_this.setState({isLandscape:isLandscape});};var _isLandscape=isOrientationLandscape(_Dimensions.default.get('window'));_this.state={isLandscape:_isLandscape};return _this;}(0,_createClass2.default)(withOrientation,[{key:\"componentDidMount\",value:function componentDidMount(){_Dimensions.default.addEventListener('change',this.handleOrientationChange);}},{key:\"componentWillUnmount\",value:function componentWillUnmount(){_Dimensions.default.removeEventListener('change',this.handleOrientationChange);}},{key:\"render\",value:function render(){return _react.default.createElement(WrappedComponent,(0,_extends2.default)({},this.props,this.state));}}]);return withOrientation;}(_react.default.Component);return(0,_hoistNonReactStatics.default)(withOrientation,WrappedComponent);}","map":{"version":3,"sources":["C:/Users/bluej/Desktop/2_2/searchGuide/searchGuide/node_modules/@react-navigation/native/dist/withOrientation.js"],"names":["isOrientationLandscape","width","height","WrappedComponent","withOrientation","handleOrientationChange","window","isLandscape","setState","Dimensions","get","state","addEventListener","removeEventListener","props","React","Component"],"mappings":"qvBAAA,oD,4FAEA,qFAEO,GAAMA,CAAAA,sBAAsB,CAAG,QAAzBA,CAAAA,sBAAyB,UAAGC,CAAAA,KAAH,MAAGA,KAAH,CAAUC,MAAV,MAAUA,MAAV,OAAuBD,CAAAA,KAAK,CAAGC,MAA/B,EAA/B,C,sDAEQ,kBAAUC,gBAAV,CAA4B,IACnCC,CAAAA,eADmC,qFAEvC,0BAAc,8DACZ,6GADY,MAedC,uBAfc,CAeY,eAAgB,IAAbC,CAAAA,MAAa,OAAbA,MAAa,CACxC,GAAMC,CAAAA,WAAW,CAAGP,sBAAsB,CAACM,MAAD,CAA1C,CACA,MAAKE,QAAL,CAAc,CAAED,WAAW,CAAXA,WAAF,CAAd,EACD,CAlBa,CAGZ,GAAMA,CAAAA,YAAW,CAAGP,sBAAsB,CAACS,oBAAWC,GAAX,CAAe,QAAf,CAAD,CAA1C,CACA,MAAKC,KAAL,CAAa,CAAEJ,WAAW,CAAXA,YAAF,CAAb,CAJY,aAKb,CAPsC,sGASnB,CAClBE,oBAAWG,gBAAX,CAA4B,QAA5B,CAAsC,KAAKP,uBAA3C,EACD,CAXsC,mEAahB,CACrBI,oBAAWI,mBAAX,CAA+B,QAA/B,CAAyC,KAAKR,uBAA9C,EACD,CAfsC,uCAsB9B,CACP,MAAO,8BAAC,gBAAD,0BAAsB,KAAKS,KAA3B,CAAsC,KAAKH,KAA3C,EAAP,CACD,CAxBsC,6BACXI,eAAMC,SADK,EA2BzC,MAAO,kCAAoBZ,eAApB,CAAqCD,gBAArC,CAAP,CACD","sourcesContent":["import React from 'react';\nimport { Dimensions } from 'react-native';\nimport hoistNonReactStatic from 'hoist-non-react-statics';\n\nexport const isOrientationLandscape = ({ width, height }) => width > height;\n\nexport default function (WrappedComponent) {\n class withOrientation extends React.Component {\n constructor() {\n super();\n\n const isLandscape = isOrientationLandscape(Dimensions.get('window'));\n this.state = { isLandscape };\n }\n\n componentDidMount() {\n Dimensions.addEventListener('change', this.handleOrientationChange);\n }\n\n componentWillUnmount() {\n Dimensions.removeEventListener('change', this.handleOrientationChange);\n }\n\n handleOrientationChange = ({ window }) => {\n const isLandscape = isOrientationLandscape(window);\n this.setState({ isLandscape });\n };\n\n render() {\n return <WrappedComponent {...this.props} {...this.state} />;\n }\n }\n\n return hoistNonReactStatic(withOrientation, WrappedComponent);\n}"]},"metadata":{},"sourceType":"script"}