Skip to content

Commit f8bef12

Browse files
committed
🐛 Fix TimePicker position flick in IE
close ant-design/ant-design#16657 close ant-design/ant-design#14460
1 parent 87708b9 commit f8bef12

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rc-time-picker",
3-
"version": "3.6.4",
3+
"version": "3.6.5",
44
"description": "React TimePicker",
55
"keywords": [
66
"react",
@@ -70,6 +70,7 @@
7070
"classnames": "2.x",
7171
"moment": "2.x",
7272
"prop-types": "^15.5.8",
73+
"raf": "^3.4.1",
7374
"rc-trigger": "^2.2.0"
7475
}
7576
}

src/Select.jsx

+5-7
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,20 @@ import React, { Component } from 'react';
33
import PropTypes from 'prop-types';
44
import ReactDom from 'react-dom';
55
import classNames from 'classnames';
6+
import raf from 'raf';
67

78
const scrollTo = (element, to, duration) => {
8-
const requestAnimationFrame =
9-
window.requestAnimationFrame ||
10-
function requestAnimationFrameTimeout() {
11-
return setTimeout(arguments[0], 10); // eslint-disable-line
12-
};
139
// jump to target if duration zero
1410
if (duration <= 0) {
15-
element.scrollTop = to;
11+
raf(() => {
12+
element.scrollTop = to;
13+
});
1614
return;
1715
}
1816
const difference = to - element.scrollTop;
1917
const perTick = (difference / duration) * 10;
2018

21-
requestAnimationFrame(() => {
19+
raf(() => {
2220
element.scrollTop += perTick;
2321
if (element.scrollTop === to) return;
2422
scrollTo(element, to, duration - 10);

0 commit comments

Comments
 (0)