File tree 2 files changed +7
-8
lines changed
2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " rc-time-picker" ,
3
- "version" : " 3.6.4 " ,
3
+ "version" : " 3.6.5 " ,
4
4
"description" : " React TimePicker" ,
5
5
"keywords" : [
6
6
" react" ,
70
70
"classnames" : " 2.x" ,
71
71
"moment" : " 2.x" ,
72
72
"prop-types" : " ^15.5.8" ,
73
+ "raf" : " ^3.4.1" ,
73
74
"rc-trigger" : " ^2.2.0"
74
75
}
75
76
}
Original file line number Diff line number Diff line change @@ -3,22 +3,20 @@ import React, { Component } from 'react';
3
3
import PropTypes from 'prop-types' ;
4
4
import ReactDom from 'react-dom' ;
5
5
import classNames from 'classnames' ;
6
+ import raf from 'raf' ;
6
7
7
8
const scrollTo = ( element , to , duration ) => {
8
- const requestAnimationFrame =
9
- window . requestAnimationFrame ||
10
- function requestAnimationFrameTimeout ( ) {
11
- return setTimeout ( arguments [ 0 ] , 10 ) ; // eslint-disable-line
12
- } ;
13
9
// jump to target if duration zero
14
10
if ( duration <= 0 ) {
15
- element . scrollTop = to ;
11
+ raf ( ( ) => {
12
+ element . scrollTop = to ;
13
+ } ) ;
16
14
return ;
17
15
}
18
16
const difference = to - element . scrollTop ;
19
17
const perTick = ( difference / duration ) * 10 ;
20
18
21
- requestAnimationFrame ( ( ) => {
19
+ raf ( ( ) => {
22
20
element . scrollTop += perTick ;
23
21
if ( element . scrollTop === to ) return ;
24
22
scrollTo ( element , to , duration - 10 ) ;
You can’t perform that action at this time.
0 commit comments