Skip to content

Commit 1353670

Browse files
committed
momentum scrolling config;
1 parent 420d84c commit 1353670

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

docs/API.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* `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)_
88
* `minimalThumbsSize`: _(number)_ Minimal size of thumb in pixels _(default: 30)_
99
* `rtl`: _(boolean)_ Override the direction style parameter _(default: undefined)_
10+
* `momentum`: _(boolean)_ Whether to use momentum scrolling on iOS _(default: true)_
1011
* `noScroll`: _(boolean)_ Disable both vertical and horizontal scrolling _(default: false)_
1112
* `noScrollY`: _(boolean)_ Disable vertical scrolling _(default: false)_
1213
* `noScrollX`: _(boolean)_ Disable horizontal scrolling _(default: false)_

src/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ export default class Scrollbar extends React.Component
6363
minimalThumbsSize: PropTypes.number,
6464
fallbackScrollbarWidth: PropTypes.number,
6565

66+
rtl: PropTypes.bool,
67+
momentum: PropTypes.bool,
6668
defaultStyles: PropTypes.bool,
6769

6870
permanentScrollbars: PropTypes.bool,
@@ -593,7 +595,7 @@ export default class Scrollbar extends React.Component
593595
minimalThumbsSize, fallbackScrollbarWidth, scrollDetectionThreshold,
594596

595597
// boolean props
596-
defaultStyles, noScroll, noScrollX, noScrollY, permanentScrollbars, permanentScrollbarX, permanentScrollbarY, rtl,
598+
defaultStyles, noScroll, noScrollX, noScrollY, permanentScrollbars, permanentScrollbarX, permanentScrollbarY, rtl, momentum = true,
597599

598600
// holder element props
599601
tagName, children, style, className,
@@ -653,6 +655,7 @@ export default class Scrollbar extends React.Component
653655
overflowY: "scroll",
654656
marginBottom: -(browserScrollbarWidth || fallbackScrollbarWidth),
655657
paddingBottom: (browserScrollbarWidth ? null : fallbackScrollbarWidth),
658+
...(momentum && {WebkitOverflowScrolling: "touch"}),
656659
},
657660
trackVerticalStyles = {
658661
...trackVerticalStyle,

0 commit comments

Comments
 (0)