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

[VirtualList] Fix off-by-one errors when rendering window-sized items. #14559

Closed
wants to merge 4 commits into from

Commits on Jun 16, 2017

  1. Fix off-by-one errors.

    I'm using a <FlatList horizontal windowSize={1} initialNumToRender={1} initialScrollIndex={1} pagingEnabled /> (where each element is exactly the width of the screen).
    
    The existing calculation would always detect a window size of 2(!). Namely because checking [375, 375, 750, 750] would cause it to match the first element (of 0, 375) and second element (of 375, 750).
    
    This causes the elements to be sized as (0, 374) and (375, 749), and in turn causes our search window to be [375, 375, 749, 749], which in turn would give a window size of exactly one, as expected.
    
    In the case of natural scroll lists, this is essentially irrelevant. In the case of pagingEnabled lists, this can result in an extra frame being rendered, and since I'm dealing with performance issues, I'm trying to minimize over-draw (at least on initial render), and want to be sure it *only* prioritizes the one element on the screen.
    mikelambert committed Jun 16, 2017
    Configuration menu
    Copy the full SHA
    cd45a21 View commit details
    Browse the repository at this point in the history

Commits on Jun 22, 2017

  1. Add tests

    mikelambert committed Jun 22, 2017
    Configuration menu
    Copy the full SHA
    b1b7b89 View commit details
    Browse the repository at this point in the history

Commits on Sep 10, 2017

  1. Configuration menu
    Copy the full SHA
    eb5e2d8 View commit details
    Browse the repository at this point in the history

Commits on Mar 1, 2018

  1. Configuration menu
    Copy the full SHA
    7bd371b View commit details
    Browse the repository at this point in the history