Comparing version 1.1.0 to 1.1.1
@@ -63,3 +63,3 @@ 'use strict'; | ||
if (!props.disabled) { | ||
setTimeout(function () { | ||
this.hackRefTimer = setTimeout(function () { | ||
(0, _domAlign2['default'])(_react2['default'].findDOMNode(_this), props.target(), props.align); | ||
@@ -73,2 +73,7 @@ }, 0); | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps() { | ||
this.clearHackRefTimer(); | ||
} | ||
}, { | ||
key: 'startMonitorWindowResize', | ||
@@ -89,2 +94,10 @@ value: function startMonitorWindowResize() { | ||
}, { | ||
key: 'clearHackRefTimer', | ||
value: function clearHackRefTimer() { | ||
if (this.hackRefTimer) { | ||
clearTimeout(this.hackRefTimer); | ||
this.hackRefTimer = null; | ||
} | ||
} | ||
}, { | ||
key: 'handleWindowResize', | ||
@@ -101,2 +114,3 @@ value: function handleWindowResize() { | ||
this.stopMonitorWindowResize(); | ||
this.clearHackRefTimer(); | ||
} | ||
@@ -106,2 +120,4 @@ }, { | ||
value: function componentDidUpdate(prevProps) { | ||
var _this2 = this; | ||
var reAlign = false; | ||
@@ -111,20 +127,22 @@ var props = this.props; | ||
if (!props.disabled) { | ||
if (prevProps.disabled || prevProps.align !== props.align) { | ||
reAlign = true; | ||
currentTarget = props.target(); | ||
} else { | ||
var lastTarget = prevProps.target(); | ||
currentTarget = props.target(); | ||
if (isWindow(lastTarget) && isWindow(currentTarget)) { | ||
reAlign = false; | ||
} else if (lastTarget !== currentTarget) { | ||
this.hackRefTimer = setTimeout(function () { | ||
if (!props.disabled) { | ||
if (prevProps.disabled || prevProps.align !== props.align) { | ||
reAlign = true; | ||
currentTarget = props.target(); | ||
} else { | ||
var lastTarget = prevProps.target(); | ||
currentTarget = props.target(); | ||
if (isWindow(lastTarget) && isWindow(currentTarget)) { | ||
reAlign = false; | ||
} else if (lastTarget !== currentTarget) { | ||
reAlign = true; | ||
} | ||
} | ||
} | ||
} | ||
if (reAlign) { | ||
(0, _domAlign2['default'])(_react2['default'].findDOMNode(this), currentTarget, props.align); | ||
} | ||
if (reAlign) { | ||
(0, _domAlign2['default'])(_react2['default'].findDOMNode(_this2), currentTarget, props.align); | ||
} | ||
}, 0); | ||
@@ -131,0 +149,0 @@ if (props.monitorWindowResize && !props.disabled) { |
{ | ||
"name": "rc-align", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "align ui component for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10663
162