Skip to content

Commit

Permalink
Flooring windowBound - offset. (#297)
Browse files Browse the repository at this point in the history
  • Loading branch information
ananyachandra14 authored and naqvitalha committed Feb 1, 2019
1 parent 88d306c commit 25d3736
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "recyclerlistview",
"version": "1.4.0-beta.sticky.14",
"version": "1.4.0-beta.sticky.15",
"description": "The listview that you need and deserve. It was built for performance, uses cell recycling to achieve smooth scrolling.",
"main": "dist/reactnative/index.js",
"types": "dist/reactnative/index.d.ts",
Expand Down
5 changes: 3 additions & 2 deletions src/core/RecyclerListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -577,12 +577,13 @@ export default class RecyclerListView<P extends RecyclerListViewProps, S extends
if (viewabilityTracker) {
const windowBound = this.props.isHorizontal ? layout.width - this._layout.width : layout.height - this._layout.height;
const lastOffset = viewabilityTracker ? viewabilityTracker.getLastOffset() : 0;
if (windowBound - lastOffset <= Default.value<number>(this.props.onEndReachedThreshold, 0)) {
const endReachedMargin = Math.floor(windowBound - lastOffset);
if (endReachedMargin <= Default.value<number>(this.props.onEndReachedThreshold, 0)) {
if (this.props.onEndReached && !this._onEndReachedCalled) {
this._onEndReachedCalled = true;
this.props.onEndReached();
}
if (this.props.onVisibleEndReached && windowBound - lastOffset <= 0) {
if (this.props.onVisibleEndReached && endReachedMargin <= 0) {
this.props.onVisibleEndReached();
}
} else {
Expand Down

0 comments on commit 25d3736

Please sign in to comment.