[FIX] Server dropdown not closing after changing stack (#1299)

This commit is contained in:
Lucas Siqueira 2019-10-28 09:46:50 -03:00 committed by Diego Mello
parent 5d96cb2d02
commit d52a7e00cc
1 changed files with 13 additions and 7 deletions

View File

@ -28,7 +28,8 @@ import {
toggleSortDropdown as toggleSortDropdownAction, toggleSortDropdown as toggleSortDropdownAction,
openSearchHeader as openSearchHeaderAction, openSearchHeader as openSearchHeaderAction,
closeSearchHeader as closeSearchHeaderAction, closeSearchHeader as closeSearchHeaderAction,
roomsRequest as roomsRequestAction roomsRequest as roomsRequestAction,
closeServerDropdown as closeServerDropdownAction
} from '../../actions/rooms'; } from '../../actions/rooms';
import { appStart as appStartAction } from '../../actions'; import { appStart as appStartAction } from '../../actions';
import debounce from '../../utils/debounce'; import debounce from '../../utils/debounce';
@ -138,7 +139,8 @@ class RoomsListView extends React.Component {
openSearchHeader: PropTypes.func, openSearchHeader: PropTypes.func,
closeSearchHeader: PropTypes.func, closeSearchHeader: PropTypes.func,
appStart: PropTypes.func, appStart: PropTypes.func,
roomsRequest: PropTypes.func roomsRequest: PropTypes.func,
closeServerDropdown: PropTypes.func
}; };
constructor(props) { constructor(props) {
@ -176,10 +178,13 @@ class RoomsListView extends React.Component {
this.handleBackPress this.handleBackPress
); );
}); });
this.willBlurListener = props.navigation.addListener('willBlur', () => BackHandler.addEventListener( this.willBlurListener = props.navigation.addListener('willBlur', () => {
'hardwareBackPress', props.closeServerDropdown();
this.handleBackPress BackHandler.addEventListener(
)); 'hardwareBackPress',
this.handleBackPress
);
});
} }
componentDidMount() { componentDidMount() {
@ -819,7 +824,8 @@ const mapDispatchToProps = dispatch => ({
closeSearchHeader: () => dispatch(closeSearchHeaderAction()), closeSearchHeader: () => dispatch(closeSearchHeaderAction()),
appStart: () => dispatch(appStartAction()), appStart: () => dispatch(appStartAction()),
roomsRequest: () => dispatch(roomsRequestAction()), roomsRequest: () => dispatch(roomsRequestAction()),
selectServerRequest: server => dispatch(selectServerRequestAction(server)) selectServerRequest: server => dispatch(selectServerRequestAction(server)),
closeServerDropdown: () => dispatch(closeServerDropdownAction())
}); });
export default connect(mapStateToProps, mapDispatchToProps)(RoomsListView); export default connect(mapStateToProps, mapDispatchToProps)(RoomsListView);