75 lines
2.3 KiB
React
75 lines
2.3 KiB
React
// Metro module 10872 (f10873).
|
|
import _objectWithoutProperties from "./_objectWithoutProperties";
|
|
import _classCallCheck from "./_classCallCheck";
|
|
import _createClass from "./_createClass";
|
|
import _possibleConstructorReturn from "./_possibleConstructorReturn";
|
|
import _getPrototypeOf from "./_getPrototypeOf";
|
|
import _inherits from "./_inherits";
|
|
import Module19 from "react";
|
|
import { TouchableHighlight } from "react-native";
|
|
import { jsx } from "react/jsx-runtime";
|
|
import { __HistoryContext } from "./Module4017";
|
|
import Module4014 from "./Module4014";
|
|
let _excluded;
|
|
let Link;
|
|
let env7311 = {};
|
|
env7311[8] = function _isNativeReflectConstruct() {
|
|
let c18329_0;
|
|
try {
|
|
c18329_0 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
} catch ($e) {}
|
|
const _isNativeReflectConstruct2 = function _isNativeReflectConstruct() {
|
|
return !!c18329_0;
|
|
};
|
|
env7311[8] = _isNativeReflectConstruct2;
|
|
return _isNativeReflectConstruct2();
|
|
};
|
|
_excluded = ["Component2", "to", "replace"];
|
|
const Component = Module19.Component;
|
|
Link = function Link(...args) {
|
|
_classCallCheck(this, Link);
|
|
const r10 = [...args];
|
|
const r9 = _getPrototypeOf(Link);
|
|
const r27 = _possibleConstructorReturn(this, (0, env7311[8])() ? Reflect.construct(r9, r10, _getPrototypeOf(this).constructor) : r9.apply(this, r10));
|
|
r27.handlePress = (a0, a1) => {
|
|
if (this.props.onPress) {
|
|
this.props.onPress(a0);
|
|
}
|
|
if (!a0.defaultPrevented) {
|
|
const props = this.props;
|
|
const to = props.to;
|
|
if (props.replace) {
|
|
a1.replace(to);
|
|
} else {
|
|
a1.push(to);
|
|
}
|
|
}
|
|
};
|
|
return r27;
|
|
};
|
|
_inherits(Link, Component);
|
|
const r41 = _createClass(Link, [{
|
|
key: "render",
|
|
value: function render() {
|
|
const props = this.props;
|
|
const Component2 = props.Component2;
|
|
props.to;
|
|
props.replace;
|
|
let c26825_0 = _objectWithoutProperties(props, _excluded);
|
|
return (0, jsx)(__HistoryContext.Consumer, {
|
|
children: (c30290_0) => <Component2 {...c26825_0} onPress={(event) => this.handlePress(event, c30290_0)} />
|
|
});
|
|
}
|
|
}]);
|
|
r41.defaultProps = {
|
|
Component2: TouchableHighlight,
|
|
replace: false
|
|
};
|
|
r41.propTypes = {
|
|
onPress: Module4014.func,
|
|
Component2: Module4014.elementType,
|
|
replace: Module4014.bool,
|
|
to: Module4014.oneOfType([Module4014.string, Module4014.object])
|
|
};
|
|
export default r41;
|