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

[ListView] broken without setInterval #1547

Closed
vishnevskiy opened this issue Jun 7, 2015 · 3 comments
Closed

[ListView] broken without setInterval #1547

vishnevskiy opened this issue Jun 7, 2015 · 3 comments
Assignees
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@vishnevskiy
Copy link
Contributor

This commit removed setInterval

34cef28

But it seems there might be a bug with ListView without it. No matter what I set initial size to eventually the ListView refuses to render the right amount of items until forced.

For example I set it to 10. If I keep changing the data source between 5 and 15 elements eventually it will render 3. Just scrolling it will reveal the rest though.

I have been unable to figure out what is causing this, will keep digging.

@brentvatne brentvatne changed the title ListView broken without setInterval [ListView] broken without setInterval Jun 7, 2015
@vishnevskiy
Copy link
Contributor Author

So looks like to reproduce this is.

  • Make 2 data sets. One that fits on the screen without scrolling and one that does not.
  • Load up the small one first.
  • Then switch it to the long data set and scroll all the way down.
  • Then switch back to small one and then instantly back again to big one.
  • It will now not render properly until you scroll.

Using a unique key for the ListView per dataset will fix it. So remounting works.

@sahrens
Copy link
Contributor

sahrens commented Jun 8, 2015

Probably just need to add an extra call to manually trigger updates when data changes to catch that corner case. I'll put out a fix soon.

@sahrens
Copy link
Contributor

sahrens commented Jun 16, 2015

Thanks for fixing this @ide!

Fanghao pushed a commit to discord/react-native that referenced this issue Jul 22, 2015
Summary:
When a new data source is provided, update `curRenderedRowsCount` in addition to `prevRenderedRowsCount`. What was happening is that I had an empty data source, so `curRenderedRowsCount` and `prevRenderedRowsCount` both settled at zero after the first few frames and `curRenderedRowsCount` wasn't getting increased when the data source was updated.

I also changed the `setState` calls to use the transactional API since several of the new state values are computed from the old ones.

Maybe fixes facebook#1547
Closes facebook#1612
Github Author: James Ide <ide@jameside.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
@facebook facebook locked as resolved and limited conversation to collaborators Jun 16, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants