Skip to content

VirtualizedList distanceFromEnd calculations should not include the footer height. #797

@edkimmel

Description

@edkimmel

Introduction

I believe the calculations around distanceToEnd in VirtualizedList should subtract the footer height.

Details

Our site uses quite a large footer to drive SEO content on our pages. For some pages, this footer can be an entire window size of height or more.

I noticed that renderAhead (virtualization disabled) and I believe onEndReached both include the footer height in their calculations for how close to the end of content the user is currently at.

The issue with this is that, with a large enough footer, the virtualized list will not render additional content until the user has scrolled past the content and are viewing the footer. This causes content to "pop in" above the fold, where they won't see it until scrolled back into view.

Discussion points

We can always keep increasing the onEndReachedThreshold to account for the ever-increasing amount of SEO content shoved into our footer, but this feels wrong. If the goal of the code is to determine how close to the end of the primary content the user is, I believe it would be more correct to take the footer height out of the equation (subtract this._footerLength).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions