Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for scroll to offset api #219

Merged
merged 3 commits into from
Jul 30, 2018
Merged

fix for scroll to offset api #219

merged 3 commits into from
Jul 30, 2018

Conversation

rajatgupta26
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@manishPatwari manishPatwari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -304,7 +300,7 @@ export default class RecyclerListView<P extends RecyclerListViewProps, S extends

public getCurrentScrollOffset(): number {
const viewabilityTracker = this._virtualRenderer.getViewabilityTracker();
return viewabilityTracker ? viewabilityTracker.getLastOffset() : 0;
return (viewabilityTracker ? viewabilityTracker.getLastOffset() : 0) + this.props.distanceFromWindow!;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If think it should be 0 if viewability tracker is unavailable otherwise without doing anything there will be a non zero offset.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, minimum offset for viewability tracker is zero. Thus this should only be attributed if lastOffset > distanceFromWindow

Adding distanceFromWindow to currentOffset only if viewability tracker’s offset is geater than distanceFromWindow
Copy link
Collaborator

@naqvitalha naqvitalha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@naqvitalha naqvitalha merged commit 9ccfbdb into master Jul 30, 2018
@naqvitalha naqvitalha deleted the scrollToFix branch July 30, 2018 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants