зеркало из https://github.com/microsoft/reactxp.git
Fixed bug #833: Eliminated full re-renders of app when mousing over popup due to interaction between setState and getChildContext.
This commit is contained in:
Родитель
8b55976144
Коммит
79218164cd
|
@ -62,9 +62,6 @@ export interface RootViewState {
|
||||||
constrainedPopupWidth: number;
|
constrainedPopupWidth: number;
|
||||||
constrainedPopupHeight: number;
|
constrainedPopupHeight: number;
|
||||||
|
|
||||||
// Are we currently hovering over the popup?
|
|
||||||
isMouseInPopup: boolean;
|
|
||||||
|
|
||||||
// Assign css focus class if focus is due to Keyboard or mouse
|
// Assign css focus class if focus is due to Keyboard or mouse
|
||||||
focusClass: string|undefined;
|
focusClass: string|undefined;
|
||||||
}
|
}
|
||||||
|
@ -138,7 +135,6 @@ export class RootView extends React.Component<RootViewProps, RootViewState> {
|
||||||
popupHeight: 0,
|
popupHeight: 0,
|
||||||
constrainedPopupWidth: 0,
|
constrainedPopupWidth: 0,
|
||||||
constrainedPopupHeight: 0,
|
constrainedPopupHeight: 0,
|
||||||
isMouseInPopup: false,
|
|
||||||
focusClass: this.props.mouseFocusOutline
|
focusClass: this.props.mouseFocusOutline
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -161,10 +157,6 @@ export class RootView extends React.Component<RootViewProps, RootViewState> {
|
||||||
this._startRepositionPopupTimer();
|
this._startRepositionPopupTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.state.isMouseInPopup) {
|
|
||||||
this._startHidePopupTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this._clickHandlerInstalled) {
|
if (!this._clickHandlerInstalled) {
|
||||||
document.addEventListener('mousedown', this._tryClosePopup);
|
document.addEventListener('mousedown', this._tryClosePopup);
|
||||||
document.addEventListener('touchstart', this._tryClosePopup);
|
document.addEventListener('touchstart', this._tryClosePopup);
|
||||||
|
@ -186,10 +178,6 @@ export class RootView extends React.Component<RootViewProps, RootViewState> {
|
||||||
this._recalcPosition();
|
this._recalcPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.state.isMouseInPopup) {
|
|
||||||
this._startHidePopupTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.props.activePopup) {
|
if (this.props.activePopup) {
|
||||||
this._startRepositionPopupTimer();
|
this._startRepositionPopupTimer();
|
||||||
}
|
}
|
||||||
|
@ -510,18 +498,10 @@ export class RootView extends React.Component<RootViewProps, RootViewState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _onMouseEnter(e: React.MouseEvent<any>) {
|
private _onMouseEnter(e: React.MouseEvent<any>) {
|
||||||
this.setState({
|
|
||||||
isMouseInPopup: true
|
|
||||||
});
|
|
||||||
|
|
||||||
this._stopHidePopupTimer();
|
this._stopHidePopupTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
private _onMouseLeave(e: React.MouseEvent<any>) {
|
private _onMouseLeave(e: React.MouseEvent<any>) {
|
||||||
this.setState({
|
|
||||||
isMouseInPopup: false
|
|
||||||
});
|
|
||||||
|
|
||||||
this._startHidePopupTimer();
|
this._startHidePopupTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче