@@ -7,9 +7,7 @@ import classNames from 'classnames';
7
7
import EventListener from 'react-event-listener' ;
8
8
import debounce from 'debounce' ; // < 1kb payload overhead when lodash/debounce is > 3kb.
9
9
import { getNormalizedScrollLeft , detectScrollType } from 'normalize-scroll-left' ;
10
- // TODO: should we fork it?
11
- // https://github.com/michaelrhodes/scroll/issues/10
12
- import scroll from 'scroll' ;
10
+ import animate from '../internal/animate' ;
13
11
import ScrollbarSize from './ScrollbarSize' ;
14
12
import withStyles from '../styles/withStyles' ;
15
13
import TabIndicator from './TabIndicator' ;
@@ -199,7 +197,7 @@ class Tabs extends React.Component {
199
197
const nextScrollLeft = this . tabsRef . scrollLeft + delta * multiplier ;
200
198
// Fix for Edge
201
199
const invert = theme . direction === 'rtl' && detectScrollType ( ) === 'reverse' ? - 1 : 1 ;
202
- scroll . left ( this . tabsRef , invert * nextScrollLeft ) ;
200
+ this . scroll ( invert * nextScrollLeft ) ;
203
201
} ;
204
202
205
203
scrollSelectedIntoView = ( ) => {
@@ -213,14 +211,18 @@ class Tabs extends React.Component {
213
211
if ( tabMeta . left < tabsMeta . left ) {
214
212
// left side of button is out of view
215
213
const nextScrollLeft = tabsMeta . scrollLeft + ( tabMeta . left - tabsMeta . left ) ;
216
- scroll . left ( this . tabsRef , nextScrollLeft ) ;
214
+ this . scroll ( nextScrollLeft ) ;
217
215
} else if ( tabMeta . right > tabsMeta . right ) {
218
216
// right side of button is out of view
219
217
const nextScrollLeft = tabsMeta . scrollLeft + ( tabMeta . right - tabsMeta . right ) ;
220
- scroll . left ( this . tabsRef , nextScrollLeft ) ;
218
+ this . scroll ( nextScrollLeft ) ;
221
219
}
222
220
} ;
223
221
222
+ scroll = value => {
223
+ animate ( 'scrollLeft' , this . tabsRef , value ) ;
224
+ } ;
225
+
224
226
updateScrollButtonState = ( ) => {
225
227
const { scrollable, scrollButtons, theme } = this . props ;
226
228
0 commit comments