New: Don't close interactive search with background click

This commit is contained in:
Mark McDowall 2021-03-11 08:22:55 -08:00
parent a9b8ec3505
commit 37e1c4f2eb
2 changed files with 24 additions and 1 deletions

View File

@ -6,6 +6,24 @@ import EpisodeDetailsModalContentConnector from './EpisodeDetailsModalContentCon
class EpisodeDetailsModal extends Component { class EpisodeDetailsModal extends Component {
//
// Lifecycle
constructor(props, context) {
super(props, context);
this.state = {
closeOnBackgroundClick: false
};
}
//
// Listeners
onTabChange = (isSearch) => {
this.setState({ closeOnBackgroundClick: !isSearch });
}
// //
// Render // Render
@ -20,10 +38,12 @@ class EpisodeDetailsModal extends Component {
<Modal <Modal
isOpen={isOpen} isOpen={isOpen}
size={sizes.EXTRA_LARGE} size={sizes.EXTRA_LARGE}
closeOnBackgroundClick={this.state.closeOnBackgroundClick}
onModalClose={onModalClose} onModalClose={onModalClose}
> >
<EpisodeDetailsModalContentConnector <EpisodeDetailsModalContentConnector
{...otherProps} {...otherProps}
onTabChange={this.onTabChange}
onModalClose={onModalClose} onModalClose={onModalClose}
/> />
</Modal> </Modal>

View File

@ -37,7 +37,9 @@ class EpisodeDetailsModalContent extends Component {
// Listeners // Listeners
onTabSelect = (index, lastIndex) => { onTabSelect = (index, lastIndex) => {
this.setState({ selectedTab: tabs[index] }); const selectedTab = tabs[index];
this.props.onTabChange(selectedTab === 'search');
this.setState({ selectedTab });
} }
// //
@ -206,6 +208,7 @@ EpisodeDetailsModalContent.propTypes = {
selectedTab: PropTypes.string.isRequired, selectedTab: PropTypes.string.isRequired,
startInteractiveSearch: PropTypes.bool.isRequired, startInteractiveSearch: PropTypes.bool.isRequired,
onMonitorEpisodePress: PropTypes.func.isRequired, onMonitorEpisodePress: PropTypes.func.isRequired,
onTabChange: PropTypes.func.isRequired,
onModalClose: PropTypes.func.isRequired onModalClose: PropTypes.func.isRequired
}; };