From 1cd769a603f3c2df78d2b56a6ac70283476be79f Mon Sep 17 00:00:00 2001
From: yiminghe <yiminghe@gmail.com>
Date: Mon, 21 Dec 2015 14:12:18 +0800
Subject: fix scroll anim

---
 src/module/Select.jsx | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'src/module/Select.jsx')

diff --git a/src/module/Select.jsx b/src/module/Select.jsx
index ab10789..2ab9e61 100644
--- a/src/module/Select.jsx
+++ b/src/module/Select.jsx
@@ -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) {
-- 
cgit v1.2.3

