@@ -337,20 +337,31 @@ function (_React$Component) {
337337 }
338338 }
339339
340- _this . isRtl = _this . props . rtl || _this . isRtl || ( rtlAutodetect ? getComputedStyle ( _this . content ) . direction === "rtl" : false ) ;
340+ var verticalScrollNotBlocked = ! _this . props . noScroll && ! _this . props . noScrollY ,
341+ horizontalScrollNotBlocked = ! _this . props . noScroll && ! _this . props . noScrollX ,
342+ verticalScrollPossible = verticalScrollNotBlocked && _this . content . scrollHeight > _this . content . clientHeight ,
343+ horizontalScrollPossible = horizontalScrollNotBlocked && _this . content . scrollWidth > _this . content . clientWidth ;
344+ var isRtl = _this . props . rtl ;
345+ ! ( 0 , _utilities . isset ) ( isRtl ) && ( isRtl = rtlAutodetect ? getComputedStyle ( _this . content ) . direction === "rtl" : _this . isRtl || false ) ;
341346
342- _this . holder . classList . toggle ( "ScrollbarsCustom-RTL" , _this . isRtl ) ;
347+ if ( forced || _this . isRtl !== isRtl ) {
348+ _this . holder . classList . toggle ( "ScrollbarsCustom-RTL" , isRtl ) ;
343349
344- var verticalScrollPossible = _this . content . scrollHeight > _this . content . clientHeight && ! _this . props . noScroll && ! _this . props . noScrollY ,
345- horizontalScrollPossible = _this . content . scrollWidth > _this . content . clientWidth && ! _this . props . noScroll && ! _this . props . noScrollX ;
350+ _this . isRtl = isRtl ;
351+ }
346352
347- if ( verticalScrollPossible && ( _this . previousScrollValues || true || _this . isRtl !== ( _this . previousScrollValues . rtl || false ) ) ) {
353+ if ( forced ) {
348354 var browserScrollbarWidth = ( 0 , _utilities . getScrollbarWidth ) ( ) ,
349355 fallbackScrollbarWidth = _this . props . fallbackScrollbarWidth ;
350- _this . content . style . marginLeft = _this . isRtl ? - ( browserScrollbarWidth || fallbackScrollbarWidth ) + "px" : null ;
351- _this . content . style . paddingLeft = _this . isRtl ? ( browserScrollbarWidth ? null : fallbackScrollbarWidth ) + "px" : null ;
352- _this . content . style . marginRight = _this . isRtl ? null : - ( browserScrollbarWidth || fallbackScrollbarWidth ) + "px" ;
353- _this . content . style . paddingRight = _this . isRtl ? null : ( browserScrollbarWidth ? null : fallbackScrollbarWidth ) + "px" ;
356+
357+ if ( verticalScrollNotBlocked ) {
358+ _this . content . style . marginLeft = isRtl ? - ( browserScrollbarWidth || fallbackScrollbarWidth ) + "px" : null ;
359+ _this . content . style . paddingLeft = isRtl ? ( browserScrollbarWidth ? null : fallbackScrollbarWidth ) + "px" : null ;
360+ _this . content . style . marginRight = isRtl ? null : - ( browserScrollbarWidth || fallbackScrollbarWidth ) + "px" ;
361+ _this . content . style . paddingRight = isRtl ? null : ( browserScrollbarWidth ? null : fallbackScrollbarWidth ) + "px" ;
362+ } else {
363+ _this . content . style . marginLeft = _this . content . style . paddingLeft = _this . content . style . marginRight = _this . content . style . paddingRight = null ;
364+ }
354365 }
355366
356367 _this . trackVertical . style . display = verticalScrollPossible || _this . props . permanentScrollbars || _this . props . permanentScrollbarY ? null : "none" ;
@@ -395,8 +406,7 @@ function (_React$Component) {
395406 scrollHeight : _this . content . scrollHeight ,
396407 scrollWidth : _this . content . scrollWidth ,
397408 clientHeight : _this . content . clientHeight ,
398- clientWidth : _this . content . clientWidth ,
399- rtl : _this . props . rtl
409+ clientWidth : _this . content . clientWidth
400410 } ;
401411 ( _this . previousScrollValues || false ) && _this . props . onScroll && _this . props . onScroll ( currentScrollValues , _assertThisInitialized ( _assertThisInitialized ( _this ) ) ) ;
402412 _this . previousScrollValues = currentScrollValues ;
@@ -409,6 +419,8 @@ function (_React$Component) {
409419 _createClass ( Scrollbar , [ {
410420 key : "componentDidMount" ,
411421 value : function componentDidMount ( ) {
422+ this . isRtl = null ;
423+
412424 _LoopController . default . registerScrollbar ( this ) ;
413425
414426 this . addListeners ( ) ;
0 commit comments