Skip to content

Commit eec3483

Browse files
author
Bas Pellis
committed
Fixed issue with index, fromIndex and toIndex when set to 0.
1 parent 5819729 commit eec3483

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@ export default class InfiniteScrollView extends Component {
88
constructor(props) {
99
super(props);
1010

11-
var fromIndex = props.fromIndex || Number.NEGATIVE_INFINITY;
12-
var toIndex = props.toIndex || Number.POSITIVE_INFINITY;
11+
var fromIndex = Number.NEGATIVE_INFINITY;
12+
if(props.fromIndex % 1 === 0) fromIndex = props.fromIndex;
13+
14+
var toIndex = Number.POSITIVE_INFINITY;
15+
if(props.toIndex % 1 === 0) toIndex = props.toIndex;
1316

1417
var index = 0;
15-
if(this.props.index) index = Math.min(Math.max(this.props.index, fromIndex), toIndex);
18+
if(this.props.index % 1 === 0) index = Math.min(Math.max(this.props.index, fromIndex), toIndex);
1619
else index = Math.max(0, fromIndex);
1720

1821
this._scrollView = null;

0 commit comments

Comments
 (0)