]> git.immae.eu Git - github/fretlink/time-picker.git/commitdiff
fix scroll anim
authoryiminghe <yiminghe@gmail.com>
Mon, 21 Dec 2015 06:12:18 +0000 (14:12 +0800)
committeryiminghe <yiminghe@gmail.com>
Mon, 21 Dec 2015 06:12:18 +0000 (14:12 +0800)
package.json
src/module/Select.jsx

index 61aabc73b39abc43de92cbd0b04cf5039f402934..358a38fff5aa280e752cac9620c36218a891cb2e 100644 (file)
@@ -1,6 +1,6 @@
 {
   "name": "rc-time-picker",
-  "version": "1.0.0-alpha9",
+  "version": "1.0.0",
   "description": "React TimePicker",
   "keywords": [
     "react",
index ab1078918795e12752bf5f98a35b8724ad061e21..2ab9e619fd90459b7023e228fa2f92c13fe900e0 100644 (file)
@@ -38,9 +38,11 @@ const Select = React.createClass({
     this.scrollToSelected(0);
   },
 
-  componentDidUpdate() {
+  componentDidUpdate(prevProps) {
     // smooth scroll to selected option
-    this.scrollToSelected(120);
+    if (prevProps.selectedIndex !== this.props.selectedIndex) {
+      this.scrollToSelected(120);
+    }
   },
 
   onSelect(value) {