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
4.1 KiB
1 line
4.1 KiB
{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/objectWithoutProperties\";\nvar _excluded = [\"to\", \"action\"];\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nimport * as React from 'react';\nimport Platform from \"react-native-web/dist/exports/Platform\";\nimport Text from \"react-native-web/dist/exports/Text\";\nimport useLinkProps from \"./useLinkProps\";\nexport default function Link(_ref) {\n var to = _ref.to,\n action = _ref.action,\n rest = _objectWithoutProperties(_ref, _excluded);\n var props = useLinkProps({\n to: to,\n action: action\n });\n var onPress = function onPress(e) {\n if ('onPress' in rest) {\n var _rest$onPress;\n (_rest$onPress = rest.onPress) === null || _rest$onPress === void 0 ? void 0 : _rest$onPress.call(rest, e);\n }\n props.onPress(e);\n };\n return React.createElement(Text, _objectSpread(_objectSpread(_objectSpread({}, props), rest), Platform.select({\n web: {\n onClick: onPress\n },\n default: {\n onPress: onPress\n }\n })));\n}","map":{"version":3,"sources":["Link.tsx"],"names":["React","useLinkProps","Link","to","action","rest","props","onPress","e","createElement","Text","Platform","select","web","onClick","default"],"mappings":";;;;;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAAA;AAAA;AAG9B,OAAOC,YAAY;AAoBnB,eAAe,SAASC,IAAI,CAAA,IAAA,EAIP;EAJyD,IAC5EC,EAAE,GAGe,IAAA,CAHjBA,EAAE;IACFC,MAAM,GAEW,IAAA,CAFjBA,MAAM;IACHC,IAAAA,4BACc,IAAA;EACjB,IAAMC,KAAK,GAAGL,YAAY,CAAY;IAAEE,EAAE,EAAFA,EAAE;IAAEC,MAAAA,EAAAA;EAAO,CAAC,CAAC;EAErD,IAAMG,OAAO,GACXC,SADID,OAAO,CACXC,CAA0E,EACvE;IACH,IAAI,SAAS,IAAIH,IAAI,EAAE;MAAA,IAAA,aAAA;MACrB,CAAA,aAAA,GAAA,IAAI,CAACE,OAAO,MAAA,IAAA,IAAA,aAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAZ,aAAA,CAAA,IAAA,CAAA,IAAI,EAAWC,CAAC,CAAC;IACnB;IAEAF,KAAK,CAACC,OAAO,CAACC,CAAC,CAAC;EAClB,CAAC;EAED,OAAOR,KAAK,CAACS,aAAa,CAACC,IAAI,gDAC1BJ,KAAK,GACLD,IAAI,GACJM,QAAQ,CAACC,MAAM,CAAC;IACjBC,GAAG,EAAE;MAAEC,OAAO,EAAEP;IAAQ,CAAQ;IAChCQ,OAAO,EAAE;MAAER,OAAAA,EAAAA;IAAQ;EACrB,CAAC,CAAA,EACD;AACJ","sourceRoot":"../../src","sourcesContent":["import * as React from 'react';\nimport { Platform, Text } from 'react-native';\nimport useLinkProps from './useLinkProps';\n/**\n * Component to render link to another screen using a path.\n * Uses an anchor tag on the web.\n *\n * @param props.to Absolute path to screen (e.g. `/feeds/hot`).\n * @param props.action Optional action to use for in-page navigation. By default, the path is parsed to an action based on linking config.\n * @param props.children Child elements to render the content.\n */\nexport default function Link(_ref) {\n let {\n to,\n action,\n ...rest\n } = _ref;\n const props = useLinkProps({\n to,\n action\n });\n const onPress = e => {\n if ('onPress' in rest) {\n var _rest$onPress;\n (_rest$onPress = rest.onPress) === null || _rest$onPress === void 0 ? void 0 : _rest$onPress.call(rest, e);\n }\n props.onPress(e);\n };\n return /*#__PURE__*/React.createElement(Text, {\n ...props,\n ...rest,\n ...Platform.select({\n web: {\n onClick: onPress\n },\n default: {\n onPress\n }\n })\n });\n}\n//# sourceMappingURL=Link.js.map"]},"metadata":{},"sourceType":"module"} |