Fix #816
parent
e4339de7c5
commit
a59395e887
|
@ -105,21 +105,32 @@ const factory = (MenuItem) => {
|
||||||
|
|
||||||
componentWillUpdate (nextProps, nextState) {
|
componentWillUpdate (nextProps, nextState) {
|
||||||
if (!this.state.active && nextState.active) {
|
if (!this.state.active && nextState.active) {
|
||||||
events.addEventsToDocument({click: this.handleDocumentClick});
|
events.addEventsToDocument({
|
||||||
|
click: this.handleDocumentClick,
|
||||||
|
touchstart: this.handleDocumentClick
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate (prevProps, prevState) {
|
componentDidUpdate (prevProps, prevState) {
|
||||||
if (prevState.active && !this.state.active) {
|
if (prevState.active && !this.state.active) {
|
||||||
if (this.props.onHide) this.props.onHide();
|
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) {
|
} else if (!prevState.active && this.state.active && this.props.onShow) {
|
||||||
this.props.onShow();
|
this.props.onShow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount () {
|
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.positionTimeoutHandle);
|
||||||
clearTimeout(this.activateTimeoutHandle);
|
clearTimeout(this.activateTimeoutHandle);
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,7 +146,3 @@ $offset: 1.8 * $unit;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
section {
|
|
||||||
overflow-x: scroll;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue