You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>But you can customize it with help pf inline or linked styles as you wish ([see docs](https://github.com/xobotyi/react-scrollbars-custom/blob/master/docs/CUSTOMISATION.md)).
*`fallbackScrollbarWidth`: _(number)_ Number of pixels that will be treated as scrollbar width if automated scrollbar width detection will fail. _This parameter used on mobiles, because scrollbars there has an absolute positioning and can't be measured.__(default: 20)_
8
8
*`minimalThumbsSize`: _(number)_ Minimal size of thumb in pixels _(default: 30)_
9
-
*`noScroll`: _(boolean)_ Disable both vertical and horizontal scrolling_(default: false)_
9
+
*`rtl`: _(boolean)_ Override the direction style parameter _(default: undefined)_
10
+
*`noScroll`: _(boolean)_ Disable both vertical and horizontal scrolling _(default: false)_
*`permanentScrollbars`: _(boolean)_ Display both, vertical and horizontal scrollbars permanently, in spite of scrolling possibility _(default: false)_
@@ -63,5 +64,7 @@
63
64
*`scrollToBottom()`: _(Scrollbar)_ Scroll to the bottom border
64
65
*`scrollToLeft()`: _(Scrollbar)_ Scroll to the left border
65
66
*`scrollToRight()`: _(Scrollbar)_ Scroll to the right border
66
-
*`update(forced=false)`: _(Scrollbar)_ Updates the scrollbars. By default if content or wrapper sizes did not changed - update will not be performed. But you can force the update by passing `true` as first parameter.
67
+
*`update(forced=false, rtlAutodetect=false)`: _(Scrollbar)_ Updates the scrollbars. By default if content or wrapper sizes did not changed - update will not be performed.
68
+
*`forced`: _(boolean)_ Whether to update the scrollbars even nothing has changed _(default: false)_
69
+
*`rtlAutodetect`: _(boolean)_ Whether to check and actualize CSS direction value _(default: false)_
67
70
Keep in mind that forced update will either trigger `onScroll` callback.
Copy file name to clipboardExpand all lines: docs/USAGE.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,3 +87,19 @@ class App extends Component
87
87
}
88
88
}
89
89
```
90
+
91
+
### RTL support
92
+
`react-scrollbars-custom` supports right-to-left direction out of the box, you don't have to pass extra properties to make it work, everything is automated, but you can override it.
93
+
But it has several nuances you should know:
94
+
* Due to performance reasons, direction detection happens in 3 situations:
95
+
* On component mount;
96
+
* On rtl property change;
97
+
* On call `scrollbar.update(undefined, true);`;
98
+
* When rtl direction detected - `ScrollbarsCustom-RTL` classname will be added to the holder;
99
+
* If `rtl` property has not set at all (undefined) - direction will be determined according to CSS;
100
+
* If `rtl` property has `true` - `direction: rtl;` style will be applied to holder;
101
+
* If `rtl` property has `false` - `direction: ltr;` style will be applied to holder;
102
+
*`rtl` property has priority over the `style` property.
103
+
```javascript
104
+
<Scrollbar style={{direction:'ltr'}} rtl />// will have RTL direction
Copy file name to clipboardExpand all lines: examples/app/components/Body.js
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,7 @@ export default class Head extends React.Component
22
22
<li>No matter what changes the content - scrollbars always stay actual</li>
23
23
<li>Total tests coverage</li>
24
24
<li>Scrollbars nesting</li>
25
+
<li>RTL support</li>
25
26
</ul>
26
27
<p><ahref="https://github.com/xobotyi/react-scrollbars-custom/tree/master/docs">Docs on GitHub</a> | <ahref="./#benchmark"target="_blank">Benchmark</a></p>
@@ -133,6 +143,7 @@ export default class SandboxBlock extends React.Component
133
143
<divclassName="button"key="permanentTracks"onClick={this.togglePermanentTracks}>{permanentTracks ? "Show tracks if needed" : "Always show tracks"}</div>
134
144
<divclassName="button"key="permanentTracksY"onClick={this.togglePermanentTrackY}>{permanentTrackY||permanentTracks ? "Show track Y if needed" : "Always show track Y"}</div>
135
145
<divclassName="button"key="permanentTracksX"onClick={this.togglePermanentTrackX}>{permanentTrackX||permanentTracks ? "Show track X if needed" : "Always show track X"}</div>
146
+
<divclassName="button"key="direction"onClick={this.toggleRtl}>{rtl ? "set direction LRT" : "set direction RTL"}</div>
0 commit comments