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

This commit is contained in:
Mark McDowall 2019-07-26 17:48:31 -07:00
parent e359347a3b
commit c47e7cd91d
2 changed files with 15 additions and 1 deletions

View File

@ -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
}; };

View File

@ -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