Skip to content

Commit

Permalink
Resolved issue of rendering initialRenderIndex in web (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
anilchembath authored and naqvitalha committed Aug 8, 2019
1 parent 38e3d6a commit cde33a2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 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": "2.0.10-beta.3",
"version": "2.0.10-beta.4",
"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
3 changes: 3 additions & 0 deletions src/core/ViewabilityTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ export default class ViewabilityTracker {
public getCurrentRenderAheadOffset(): number {
return this._renderAheadOffset;
}
public setActualOffset(actualOffset: number): void {
this._actualOffset = actualOffset;
}

private _findFirstVisibleIndexOptimally(): number {
let firstVisibleIndex = 0;
Expand Down
10 changes: 5 additions & 5 deletions src/core/VirtualRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ export default class VirtualRenderer {

public updateOffset(offsetX: number, offsetY: number, correction: number, isActual: boolean): void {
if (this._viewabilityTracker) {
const offset = this._params && this._params.isHorizontal ? offsetX : offsetY;
if (!this._isViewTrackerRunning) {
if (isActual) {
this._viewabilityTracker.setActualOffset(offset);
}
this.startViewabilityTracker();
}
if (this._params && this._params.isHorizontal) {
this._viewabilityTracker.updateOffset(offsetX, correction, isActual);
} else {
this._viewabilityTracker.updateOffset(offsetY, correction, isActual);
}
this._viewabilityTracker.updateOffset(offset, correction, isActual);
}
}

Expand Down

0 comments on commit cde33a2

Please sign in to comment.