Javi Velasco 2016-10-06 20:18:35 +02:00
parent e4339de7c5
commit a59395e887
2 changed files with 14 additions and 7 deletions

View File

@ -105,21 +105,32 @@ const factory = (MenuItem) => {
componentWillUpdate (nextProps, nextState) {
if (!this.state.active && nextState.active) {
events.addEventsToDocument({click: this.handleDocumentClick});
events.addEventsToDocument({
click: this.handleDocumentClick,
touchstart: this.handleDocumentClick
});
}
}
componentDidUpdate (prevProps, prevState) {
if (prevState.active && !this.state.active) {
if (this.props.onHide) this.props.onHide();
events.removeEventsFromDocument({click: this.handleDocumentClick});
events.removeEventsFromDocument({
click: this.handleDocumentClick,
touchstart: this.handleDocumentClick
});
} else if (!prevState.active && this.state.active && this.props.onShow) {
this.props.onShow();
}
}
componentWillUnmount () {
if (this.state.active) events.removeEventsFromDocument({click: this.handleDocumentClick});
if (this.state.active) {
events.removeEventsFromDocument({
click: this.handleDocumentClick,
touchstart: this.handleDocumentClick
});
}
clearTimeout(this.positionTimeoutHandle);
clearTimeout(this.activateTimeoutHandle);
}

View File

@ -146,7 +146,3 @@ $offset: 1.8 * $unit;
height: 40px;
}
}
section {
overflow-x: scroll;
}