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
12 KiB

{"ast":null,"code":"import _defineProperty2 from \"@babel/runtime/helpers/defineProperty\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/objectWithoutProperties\";\nimport _classCallCheck from \"@babel/runtime/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/inherits\";\nimport _possibleConstructorReturn from \"@babel/runtime/helpers/possibleConstructorReturn\";\nimport _getPrototypeOf from \"@babel/runtime/helpers/getPrototypeOf\";\nvar _excluded = [\"style\"];\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) { _defineProperty2(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; }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _extends() {\n _extends = Object.assign || 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}\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\nimport * as React from 'react';\nimport { Component } from 'react';\nimport GenericTouchable, { TOUCHABLE_STATE } from \"./GenericTouchable\";\nimport StyleSheet from \"react-native-web/dist/exports/StyleSheet\";\nimport View from \"react-native-web/dist/exports/View\";\nvar TouchableHighlight = function (_Component) {\n _inherits(TouchableHighlight, _Component);\n var _super = _createSuper(TouchableHighlight);\n function TouchableHighlight(props) {\n var _this;\n _classCallCheck(this, TouchableHighlight);\n _this = _super.call(this, props);\n _defineProperty(_assertThisInitialized(_this), \"showUnderlay\", function () {\n var _this$props$onShowUnd, _this$props;\n if (!_this.hasPressHandler()) {\n return;\n }\n _this.setState({\n extraChildStyle: {\n opacity: _this.props.activeOpacity\n },\n extraUnderlayStyle: {\n backgroundColor: _this.props.underlayColor\n }\n });\n (_this$props$onShowUnd = (_this$props = _this.props).onShowUnderlay) === null || _this$props$onShowUnd === void 0 ? void 0 : _this$props$onShowUnd.call(_this$props);\n });\n _defineProperty(_assertThisInitialized(_this), \"hasPressHandler\", function () {\n return _this.props.onPress || _this.props.onPressIn || _this.props.onPressOut || _this.props.onLongPress;\n });\n _defineProperty(_assertThisInitialized(_this), \"hideUnderlay\", function () {\n var _this$props$onHideUnd, _this$props2;\n _this.setState({\n extraChildStyle: null,\n extraUnderlayStyle: null\n });\n (_this$props$onHideUnd = (_this$props2 = _this.props).onHideUnderlay) === null || _this$props$onHideUnd === void 0 ? void 0 : _this$props$onHideUnd.call(_this$props2);\n });\n _defineProperty(_assertThisInitialized(_this), \"onStateChange\", function (_from, to) {\n if (to === TOUCHABLE_STATE.BEGAN) {\n _this.showUnderlay();\n } else if (to === TOUCHABLE_STATE.UNDETERMINED || to === TOUCHABLE_STATE.MOVED_OUTSIDE) {\n _this.hideUnderlay();\n }\n });\n _this.state = {\n extraChildStyle: null,\n extraUnderlayStyle: null\n };\n return _this;\n }\n _createClass(TouchableHighlight, [{\n key: \"renderChildren\",\n value: function renderChildren() {\n if (!this.props.children) {\n return React.createElement(View, null);\n }\n var child = React.Children.only(this.props.children);\n return React.cloneElement(child, {\n style: StyleSheet.compose(child.props.style, this.state.extraChildStyle)\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this$props3 = this.props,\n _this$props3$style = _this$props3.style,\n style = _this$props3$style === void 0 ? {} : _this$props3$style,\n rest = _objectWithoutProperties(_this$props3, _excluded);\n var extraUnderlayStyle = this.state.extraUnderlayStyle;\n return React.createElement(GenericTouchable, _extends({}, rest, {\n style: [style, extraUnderlayStyle],\n onStateChange: this.onStateChange\n }), this.renderChildren());\n }\n }]);\n return TouchableHighlight;\n}(Component);\nexport { TouchableHighlight as default };\n_defineProperty(TouchableHighlight, \"defaultProps\", _objectSpread(_objectSpread({}, GenericTouchable.defaultProps), {}, {\n activeOpacity: 0.85,\n delayPressOut: 100,\n underlayColor: 'black'\n}));","map":{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,SAAT,QAA0B,OAA1B;AACA,OAAOC,gBAAP,IAEEC,eAFF;AAAA;AAAA;AAAA,IAwBqBC,kBAAN;EAAA;EAAA;EAWbC,4BAAYC,KAAD,EAAyD;IAAA;IAAA;IAClE,0BAAMA,KAAN;IADkEC,+DASrD,YAAM;MAAA;MACnB,IAAI,CAAC,MAAKC,eAAL,EAAL,EAA6B;QAC3B;MACD;MACD,MAAKC,QAAL,CAAc;QACZC,eAAe,EAAE;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KR,KAAL,CAAWnB,eAAjD;MADwB,CAA1B,CAAP;IAGD;EAAA;IAAA;IAAA,OAaD8B,kBAAS;MACP,mBAAgC,KAAKlC,KAArC;QAAA,kCAAQ+B,KAAK;QAALA,KAAK,mCAAG,EAAV;QAAiBI;MACvB,IAAQ5B,qBAAuB,KAAKgB,KAApC,CAAQhB;MACR,OACEb,oBAACE,gBAAD,eACMuC,IADN;QAEEJ,KAAK,EAAE,CAACA,KAAD,EAAQxB,kBAAR,CAFT;QAGE6B,aAAa,EAAE,KAAKA;MAHtB,IAIG,KAAKZ,cAAL,EAJH,CADF;IAQD;EAAA;EAAA;AAAA,EApF6C7B,SAAjC;AAAA,SAAMG,kBAAN;gBAAMA,kB,kDAKdF,gBAAgB,CAACyC,YADA;EAEpB/B,aAAa,EAAE,IAFK;EAGpBgC,aAAa,EAAE,GAHK;EAIpB7B,aAAa,EAAE;AAAA,G","names":["React","Component","GenericTouchable","TOUCHABLE_STATE","TouchableHighlight","constructor","props","_defineProperty","hasPressHandler","setState","extraChildStyle","opacity","activeOpacity","extraUnderlayStyle","backgroundColor","underlayColor","onShowUnderlay","onPress","onPressIn","onPressOut","onLongPress","onHideUnderlay","_from","to","BEGAN","showUnderlay","UNDETERMINED","MOVED_OUTSIDE","hideUnderlay","state","renderChildren","children","View","child","Children","only","cloneElement","style","StyleSheet","compose","render","rest","onStateChange","defaultProps","delayPressOut"],"sources":["/Users/mathildejean/Documents/BUT/LaSuperMeteo/LaSuperMeteo/iut-expo-starter/node_modules/react-native-gesture-handler/lib/module/components/touchables/TouchableHighlight.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Component } from 'react';\nimport GenericTouchable, {\n GenericTouchableProps,\n TOUCHABLE_STATE,\n} from './GenericTouchable';\nimport {\n StyleSheet,\n View,\n TouchableHighlightProps,\n ColorValue,\n ViewProps,\n} from 'react-native';\n\ninterface State {\n extraChildStyle: null | {\n opacity?: number;\n };\n extraUnderlayStyle: null | {\n backgroundColor?: ColorValue;\n };\n}\n\n/**\n * TouchableHighlight follows RN's implementation\n */\nexport default class TouchableHighlight extends Component<\n TouchableHighlightProps & GenericTouchableProps,\n State\n> {\n static defaultProps = {\n ...GenericTouchable.defaultProps,\n activeOpacity: 0.85,\n delayPressOut: 100,\n underlayColor: 'black',\n };\n\n constructor(props: TouchableHighlightProps & GenericTouchableProps) {\n super(props);\n this.state = {\n extraChildStyle: null,\n extraUnderlayStyle: null,\n };\n }\n\n // Copied from RN\n showUnderlay = () => {\n if (!this.hasPressHandler()) {\n return;\n }\n this.setState({\n extraChildStyle: {\n opacity: this.props.activeOpacity,\n },\n extraUnderlayStyle: {\n backgroundColor: this.props.underlayColor,\n },\n });\n this.props.onShowUnderlay?.();\n };\n\n hasPressHandler = () =>\n this.props.onPress ||\n this.props.onPressIn ||\n this.props.onPressOut ||\n this.props.onLongPress;\n\n hideUnderlay = () => {\n this.setState({\n extraChildStyle: null,\n extraUnderlayStyle: null,\n });\n this.props.onHideUnderlay?.();\n };\n\n renderChildren() {\n if (!this.props.children) {\n return <View />;\n }\n\n const child = React.Children.only(\n this.props.children\n ) as React.ReactElement<ViewProps>; // TODO: not sure if OK but fixes error\n return React.cloneElement(child, {\n style: StyleSheet.compose(child.props.style, this.state.extraChildStyle),\n });\n }\n\n onStateChange = (_from: number, to: number) => {\n if (to === TOUCHABLE_STATE.BEGAN) {\n this.showUnderlay();\n } else if (\n to === TOUCHABLE_STATE.UNDETERMINED ||\n to === TOUCHABLE_STATE.MOVED_OUTSIDE\n ) {\n this.hideUnderlay();\n }\n };\n\n render() {\n const { style = {}, ...rest } = this.props;\n const { extraUnderlayStyle } = this.state;\n return (\n <GenericTouchable\n {...rest}\n style={[style, extraUnderlayStyle]}\n onStateChange={this.onStateChange}>\n {this.renderChildren()}\n </GenericTouchable>\n );\n }\n}\n"]},"metadata":{},"sourceType":"module","externalDependencies":[]}