Fixed: Canceling editing a custom filter won't close the Custom filter modal

Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
pull/6/head
Qstick 6 years ago
parent 07ecd824ea
commit 8440675ad9

@ -132,6 +132,7 @@ class FilterBuilderModalContent extends Component {
filterBuilderProps, filterBuilderProps,
isSaving, isSaving,
saveError, saveError,
onCancelPress,
onModalClose onModalClose
} = this.props; } = this.props;
@ -190,7 +191,7 @@ class FilterBuilderModalContent extends Component {
</ModalBody> </ModalBody>
<ModalFooter> <ModalFooter>
<Button onPress={onModalClose}> <Button onPress={onCancelPress}>
Cancel Cancel
</Button> </Button>
@ -220,6 +221,7 @@ FilterBuilderModalContent.propTypes = {
dispatchDeleteCustomFilter: PropTypes.func.isRequired, dispatchDeleteCustomFilter: PropTypes.func.isRequired,
onSaveCustomFilterPress: PropTypes.func.isRequired, onSaveCustomFilterPress: PropTypes.func.isRequired,
dispatchSetFilter: PropTypes.func.isRequired, dispatchSetFilter: PropTypes.func.isRequired,
onCancelPress: PropTypes.func.isRequired,
onModalClose: PropTypes.func.isRequired onModalClose: PropTypes.func.isRequired
}; };

@ -34,6 +34,17 @@ class FilterModal extends Component {
}); });
} }
onCancelPress = () => {
if (this.state.filterBuilder) {
this.setState({
filterBuilder: false,
id: null
});
} else {
this.onModalClose();
}
}
onModalClose = () => { onModalClose = () => {
this.setState({ this.setState({
filterBuilder: false, filterBuilder: false,
@ -67,6 +78,7 @@ class FilterModal extends Component {
<FilterBuilderModalContentConnector <FilterBuilderModalContentConnector
{...otherProps} {...otherProps}
id={id} id={id}
onCancelPress={this.onCancelPress}
onModalClose={this.onModalClose} onModalClose={this.onModalClose}
/> : /> :
<CustomFiltersModalContentConnector <CustomFiltersModalContentConnector

Loading…
Cancel
Save