62 lines
1.9 KiB
JavaScript
62 lines
1.9 KiB
JavaScript
// Metro module 10870 (f10871).
|
|
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 { BackHandler } from "react-native";
|
|
import { jsx } from "react/jsx-runtime";
|
|
import { __HistoryContext } from "./Module4017";
|
|
let BackButton;
|
|
let env7307 = {};
|
|
env7307[7] = function _isNativeReflectConstruct() {
|
|
let c18327_0;
|
|
try {
|
|
c18327_0 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
} catch ($e) {}
|
|
const _isNativeReflectConstruct2 = function _isNativeReflectConstruct() {
|
|
return !!c18327_0;
|
|
};
|
|
env7307[7] = _isNativeReflectConstruct2;
|
|
return _isNativeReflectConstruct2();
|
|
};
|
|
const Component = Module19.Component;
|
|
BackButton = function BackButton(...args) {
|
|
_classCallCheck(this, BackButton);
|
|
const r10 = [...args];
|
|
const r9 = _getPrototypeOf(BackButton);
|
|
const r27 = _possibleConstructorReturn(this, (0, env7307[7])() ? Reflect.construct(r9, r10, _getPrototypeOf(this).constructor) : r9.apply(this, r10));
|
|
r27.handleBack = () => {
|
|
let r1 = this.history.index !== 0;
|
|
if (r1) {
|
|
this.history.goBack();
|
|
r1 = true;
|
|
}
|
|
return r1;
|
|
};
|
|
return r27;
|
|
};
|
|
_inherits(BackButton, Component);
|
|
export default _createClass(BackButton, [{
|
|
key: "componentDidMount",
|
|
value: function componentDidMount() {
|
|
BackHandler.addEventListener("hardwareBackPress", this.handleBack);
|
|
}
|
|
}, {
|
|
key: "componentWillUnmount",
|
|
value: function componentWillUnmount() {
|
|
BackHandler.removeEventListener("hardwareBackPress", this.handleBack);
|
|
}
|
|
}, {
|
|
key: "render",
|
|
value: function render() {
|
|
return (0, jsx)(__HistoryContext.Consumer, {
|
|
children: (a0) => {
|
|
this.history = a0;
|
|
return this.props.children || null;
|
|
}
|
|
});
|
|
}
|
|
}]);
|