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

View File

@ -37,7 +37,9 @@ class EpisodeDetailsModalContent extends Component {
// Listeners
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,
startInteractiveSearch: PropTypes.bool.isRequired,
onMonitorEpisodePress: PropTypes.func.isRequired,
onTabChange: PropTypes.func.isRequired,
onModalClose: PropTypes.func.isRequired
};