diff options
author | yiminghe <yiminghe@gmail.com> | 2015-12-21 14:12:18 +0800 |
---|---|---|
committer | yiminghe <yiminghe@gmail.com> | 2015-12-21 14:12:18 +0800 |
commit | 1cd769a603f3c2df78d2b56a6ac70283476be79f (patch) | |
tree | 66563264ebacf070d161d1faeee7f7f41ffca174 /src | |
parent | aed96fd625c23d720f0f4a684c1fcd62b7399be7 (diff) | |
download | time-picker-1cd769a603f3c2df78d2b56a6ac70283476be79f.tar.gz time-picker-1cd769a603f3c2df78d2b56a6ac70283476be79f.tar.zst time-picker-1cd769a603f3c2df78d2b56a6ac70283476be79f.zip |
fix scroll anim
Diffstat (limited to 'src')
-rw-r--r-- | src/module/Select.jsx | 6 |
1 files changed, 4 insertions, 2 deletions
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({ | |||
38 | this.scrollToSelected(0); | 38 | this.scrollToSelected(0); |
39 | }, | 39 | }, |
40 | 40 | ||
41 | componentDidUpdate() { | 41 | componentDidUpdate(prevProps) { |
42 | // smooth scroll to selected option | 42 | // smooth scroll to selected option |
43 | this.scrollToSelected(120); | 43 | if (prevProps.selectedIndex !== this.props.selectedIndex) { |
44 | this.scrollToSelected(120); | ||
45 | } | ||
44 | }, | 46 | }, |
45 | 47 | ||
46 | onSelect(value) { | 48 | onSelect(value) { |