Changed boolean to event, to execute in Mendix

This commit is contained in:
bartonstee
2020-10-01 10:30:49 +02:00
committed by GitHub
parent 66cb4817cb
commit 786b48de7d
8 changed files with 28 additions and 42 deletions

Binary file not shown.

View File

@@ -7,14 +7,11 @@
<description>Disregard back events on page</description>
<icon/>
<properties>
<propertyGroup caption="General">
<property key="disableBack" type="attribute" required="true">
<caption>Disable</caption>
<description>Boolean for enabling/disabling backhandler</description>
<attributeTypes>
<attributeType name="Boolean"/>
</attributeTypes>
<propertyGroup caption="Events">
<property key="onBack" type="action" required="false">
<caption>On backpress</caption>
<description>Flow to call when hardware backbutton is used.</description>
</property>
</propertyGroup>
</propertyGroup>
</properties>
</widget>

View File

@@ -112,14 +112,14 @@ class Backhandler extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
return (Object(react__WEBPACK_IMPORTED_MODULE_0__["createElement"])(react_native__WEBPACK_IMPORTED_MODULE_1__["View"], null));
}
componentWillMount() {
if (this.props.disableBack) {
react_native__WEBPACK_IMPORTED_MODULE_1__["BackHandler"].addEventListener('hardwareBackPress', this.handleBackButtonClick);
}
react_native__WEBPACK_IMPORTED_MODULE_1__["BackHandler"].addEventListener('hardwareBackPress', this.handleBackButtonClick);
}
componentWillUnmount() {
react_native__WEBPACK_IMPORTED_MODULE_1__["BackHandler"].removeEventListener('hardwareBackPress', this.handleBackButtonClick);
}
handleBackButtonClick() {
var _a;
(_a = this.props.onBack) === null || _a === void 0 ? void 0 : _a.execute();
return true;
}
}

File diff suppressed because one or more lines are too long