From 1cd769a603f3c2df78d2b56a6ac70283476be79f Mon Sep 17 00:00:00 2001 From: yiminghe Date: Mon, 21 Dec 2015 14:12:18 +0800 Subject: fix scroll anim --- package.json | 2 +- src/module/Select.jsx | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 61aabc7..358a38f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rc-time-picker", - "version": "1.0.0-alpha9", + "version": "1.0.0", "description": "React TimePicker", "keywords": [ "react", 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