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

Non-stop re-rendering #41

Closed
maynir opened this issue Aug 13, 2018 · 4 comments
Closed

Non-stop re-rendering #41

maynir opened this issue Aug 13, 2018 · 4 comments
Labels
💬 question Further information is requested

Comments

@maynir
Copy link

maynir commented Aug 13, 2018

I'm having a non-stop re-rendering.
In this simple example, I'm just rendering div containing "X".
I gave it the right height and width, tried to remove every possible CSS and I just can't get it.

Elements:
ezgif com-crop

Screen:
ezgif com-video-to-gif

my code:

<div>
        <List
                height={200}
                itemCount={this.state.filteredValues.length}
                itemSize={17}
                width={682}
                overscanCount={10}
            >
                {({ index, style }) => (
                    <div> X </div>
                )}
            </List>
    </div>
@bvaughn
Copy link
Owner

bvaughn commented Aug 13, 2018

I gave it the right height and width, tried to remove every possible CSS and I just can't get it.

Not sure what you mean by this, but your example doesn't seem to be using the style parameter passed to it which would cause a problem. The style parameter is what positions and sizes the elements in your list.

Also, what do you mean by "nonstop rendering" ? In the code example you provide above, you configure the list to be 200 pixels tall and tell it that items are 17 pixels tall, and that you want it to pre-render ("overscan") 10 additional items. This means that it will render ~22 items. (As a side note, I would advise against an overscan value that high. Probably 1-3 is best.)

@bvaughn bvaughn added the 💬 question Further information is requested label Aug 13, 2018
@bvaughn
Copy link
Owner

bvaughn commented Aug 13, 2018

I'm going to close this issue since it isn't really actionable. We can chat more here if there are follow up questions though.

@bvaughn bvaughn closed this as completed Aug 13, 2018
@maynir
Copy link
Author

maynir commented Aug 16, 2018 via email

@bvaughn
Copy link
Owner

bvaughn commented Aug 18, 2018

No, nothing built into react-window. I think the easiest thing to do is to just return a different component, e.g.

if (numItems === 0) {
  return <NoResultsView />;
} else {
  return <FixedSizeList />;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💬 question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants