You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
5.6 KiB
1 line
5.6 KiB
{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/objectWithoutProperties\";\nvar _excluded = [\"enabled\", \"layout\", \"style\"];\nfunction _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}\nimport * as React from 'react';\nimport StyleSheet from \"react-native-web/dist/exports/StyleSheet\";\nimport View from \"react-native-web/dist/exports/View\";\nexport default React.forwardRef(function CardSheet(_ref, ref) {\n var enabled = _ref.enabled,\n layout = _ref.layout,\n style = _ref.style,\n rest = _objectWithoutProperties(_ref, _excluded);\n var _React$useState = React.useState(false),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n fill = _React$useState2[0],\n setFill = _React$useState2[1];\n var _React$useState3 = React.useState('auto'),\n _React$useState4 = _slicedToArray(_React$useState3, 2),\n pointerEvents = _React$useState4[0],\n setPointerEvents = _React$useState4[1];\n React.useImperativeHandle(ref, function () {\n return {\n setPointerEvents: setPointerEvents\n };\n });\n React.useEffect(function () {\n if (typeof document === 'undefined' || !document.body) {\n return;\n }\n var width = document.body.clientWidth;\n var height = document.body.clientHeight;\n setFill(width === layout.width && height === layout.height);\n }, [layout.height, layout.width]);\n return React.createElement(View, _extends({}, rest, {\n pointerEvents: pointerEvents,\n style: [enabled && fill ? styles.page : styles.card, style]\n }));\n});\nvar styles = StyleSheet.create({\n page: {\n minHeight: '100%'\n },\n card: {\n flex: 1,\n overflow: 'hidden'\n }\n});","map":{"version":3,"sources":["CardSheet.tsx"],"names":["React","forwardRef","CardSheet","enabled","layout","style","rest","ref","fill","setFill","useState","pointerEvents","setPointerEvents","useImperativeHandle","useEffect","document","body","width","clientWidth","height","clientHeight","styles","page","card","StyleSheet","create","minHeight","flex","overflow"],"mappings":";;;;;;;;;;;;;;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAAA;AAAA;AAiB9B,eAAeA,KAAK,CAACC,UAAU,CAAsB,SAASC,SAAS,CAAA,IAAA,EAErEK,GAAG,EACH;EAFA,IAAEJ,OAAO,GAA0B,IAAA,CAAjCA,OAAO;IAAEC,MAAM,GAAkB,IAAA,CAAxBA,MAAM;IAAEC,KAAK,GAAW,IAAA,CAAhBA,KAAK;IAAKC,IAAAA,4BAAM,IAAA;EAGnC,sBAAwBN,KAAK,CAACU,QAAQ,CAAC,KAAK,CAAC;IAAA;IAAtCF,IAAI;IAAEC,OAAO;EAGpB,uBACET,KAAK,CAACU,QAAQ,CAA6B,MAAM,CAAC;IAAA;IAD7CC,aAAa;IAAEC,gBAAgB;EAGtCZ,KAAK,CAACa,mBAAmB,CAACN,GAAG,EAAE,YAAM;IACnC,OAAO;MAAEK,gBAAAA,EAAAA;IAAiB,CAAC;EAC7B,CAAC,CAAC;EAEFZ,KAAK,CAACc,SAAS,CAAC,YAAM;IACpB,IAAI,OAAOC,QAAQ,KAAK,WAAW,IAAI,CAACA,QAAQ,CAACC,IAAI,EAAE;MAErD;IACF;IAEA,IAAMC,KAAK,GAAGF,QAAQ,CAACC,IAAI,CAACE,WAAW;IACvC,IAAMC,MAAM,GAAGJ,QAAQ,CAACC,IAAI,CAACI,YAAY;IAEzCX,OAAO,CAACQ,KAAK,KAAKb,MAAM,CAACa,KAAK,IAAIE,MAAM,KAAKf,MAAM,CAACe,MAAM,CAAC;EAC7D,CAAC,EAAE,CAACf,MAAM,CAACe,MAAM,EAAEf,MAAM,CAACa,KAAK,CAAC,CAAC;EAEjC,OACE,KAAA,CAAA,aAAA,CAAC,IAAI,EAAA,QAAA,CAAA,CAAA,CAAA,EACCX,IAAI,EAAA;IACR,aAAa,EAAEK,aAAc;IAC7B,KAAK,EAAE,CAACR,OAAO,IAAIK,IAAI,GAAGa,MAAM,CAACC,IAAI,GAAGD,MAAM,CAACE,IAAI,EAAElB,KAAK;EAAE,CAAA,CAAA,CAC5D;AAEN,CAAC,CAAC;AAEF,IAAMgB,MAAM,GAAGG,UAAU,CAACC,MAAM,CAAC;EAC/BH,IAAI,EAAE;IACJI,SAAS,EAAE;EACb,CAAC;EACDH,IAAI,EAAE;IACJI,IAAI,EAAE,CAAC;IACPC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","sourceRoot":"../../src","sourcesContent":["function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nimport * as React from 'react';\nimport { StyleSheet, View } from 'react-native';\n// This component will render a page which overflows the screen\n// if the container fills the body by comparing the size\n// This lets the document.body handle scrolling of the content\n// It's necessary for mobile browsers to be able to hide address bar on scroll\nexport default /*#__PURE__*/React.forwardRef(function CardSheet(_ref, ref) {\n let {\n enabled,\n layout,\n style,\n ...rest\n } = _ref;\n const [fill, setFill] = React.useState(false);\n // To avoid triggering a rerender in Card during animation we had to move\n // the state to CardSheet. The `setPointerEvents` is then hoisted back to the Card.\n const [pointerEvents, setPointerEvents] = React.useState('auto');\n React.useImperativeHandle(ref, () => {\n return {\n setPointerEvents\n };\n });\n React.useEffect(() => {\n if (typeof document === 'undefined' || !document.body) {\n // Only run when DOM is available\n return;\n }\n const width = document.body.clientWidth;\n const height = document.body.clientHeight;\n setFill(width === layout.width && height === layout.height);\n }, [layout.height, layout.width]);\n return /*#__PURE__*/React.createElement(View, _extends({}, rest, {\n pointerEvents: pointerEvents,\n style: [enabled && fill ? styles.page : styles.card, style]\n }));\n});\nconst styles = StyleSheet.create({\n page: {\n minHeight: '100%'\n },\n card: {\n flex: 1,\n overflow: 'hidden'\n }\n});\n//# sourceMappingURL=CardSheet.js.map"]},"metadata":{},"sourceType":"module"} |