1
1
import raf , { cancel as caf } from 'raf' ;
2
2
import css from 'dom-css' ;
3
- import React , { createClass , PropTypes , cloneElement } from 'react' ;
3
+ import { createClass , createElement , PropTypes , cloneElement } from 'react' ;
4
4
import isString from '../utils/isString' ;
5
5
import getScrollbarWidth from '../utils/getScrollbarWidth' ;
6
6
import returnFalse from '../utils/returnFalse' ;
@@ -13,7 +13,6 @@ import {
13
13
viewStyleDefault ,
14
14
viewStyleAutoHeight ,
15
15
viewStyleUniversalInitial ,
16
- viewStyleAutoHeightUniversalInitial ,
17
16
trackHorizontalStyleDefault ,
18
17
trackVerticalStyleDefault ,
19
18
thumbHorizontalStyleDefault ,
@@ -45,6 +44,7 @@ export default createClass({
45
44
renderTrackVertical : PropTypes . func ,
46
45
renderThumbHorizontal : PropTypes . func ,
47
46
renderThumbVertical : PropTypes . func ,
47
+ tagName : PropTypes . string ,
48
48
thumbSize : PropTypes . number ,
49
49
thumbMinSize : PropTypes . number ,
50
50
hideTracksWhenNotNeeded : PropTypes . bool ,
@@ -72,6 +72,7 @@ export default createClass({
72
72
renderTrackVertical : renderTrackVerticalDefault ,
73
73
renderThumbHorizontal : renderThumbHorizontalDefault ,
74
74
renderThumbVertical : renderThumbVerticalDefault ,
75
+ tagName : 'div' ,
75
76
thumbMinSize : 30 ,
76
77
hideTracksWhenNotNeeded : false ,
77
78
autoHide : false ,
@@ -522,6 +523,7 @@ export default createClass({
522
523
renderTrackVertical,
523
524
renderThumbHorizontal,
524
525
renderThumbVertical,
526
+ tagName,
525
527
hideTracksWhenNotNeeded,
526
528
autoHide,
527
529
autoHideTimeout,
@@ -595,30 +597,28 @@ export default createClass({
595
597
} )
596
598
} ;
597
599
598
- return (
599
- < div { ...props } style = { containerStyle } ref = "container" >
600
- { cloneElement (
601
- renderView ( { style : viewStyle } ) ,
602
- { ref : 'view' } ,
603
- children
604
- ) }
605
- { cloneElement (
606
- renderTrackHorizontal ( { style : trackHorizontalStyle } ) ,
607
- { ref : 'trackHorizontal' } ,
608
- cloneElement (
609
- renderThumbHorizontal ( { style : thumbHorizontalStyleDefault } ) ,
610
- { ref : 'thumbHorizontal' }
611
- )
612
- ) }
613
- { cloneElement (
614
- renderTrackVertical ( { style : trackVerticalStyle } ) ,
615
- { ref : 'trackVertical' } ,
616
- cloneElement (
617
- renderThumbVertical ( { style : thumbVerticalStyleDefault } ) ,
618
- { ref : 'thumbVertical' }
619
- )
620
- ) }
621
- </ div >
622
- ) ;
600
+ return createElement ( tagName , { ...props , style : containerStyle , ref : 'container' } , [
601
+ cloneElement (
602
+ renderView ( { style : viewStyle } ) ,
603
+ { key : 'view' , ref : 'view' } ,
604
+ children
605
+ ) ,
606
+ cloneElement (
607
+ renderTrackHorizontal ( { style : trackHorizontalStyle } ) ,
608
+ { key : 'trackHorizontal' , ref : 'trackHorizontal' } ,
609
+ cloneElement (
610
+ renderThumbHorizontal ( { style : thumbHorizontalStyleDefault } ) ,
611
+ { ref : 'thumbHorizontal' }
612
+ )
613
+ ) ,
614
+ cloneElement (
615
+ renderTrackVertical ( { style : trackVerticalStyle } ) ,
616
+ { key : 'trackVertical' , ref : 'trackVertical' } ,
617
+ cloneElement (
618
+ renderThumbVertical ( { style : thumbVerticalStyleDefault } ) ,
619
+ { ref : 'thumbVertical' }
620
+ )
621
+ )
622
+ ] ) ;
623
623
}
624
624
} ) ;
0 commit comments