question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Animated.Loop prevents VirtualizedList updates

See original GitHub issue

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment: OS: macOS Sierra 10.12.6 Node: 6.9.1 Yarn: 0.17.9 npm: 3.10.10 Watchman: 4.7.0 Xcode: Xcode 8.3 Build version 8E162 Android Studio: 2.2 AI-145.3537739

Packages: (wanted => installed) react: 16.0.0-alpha.12 => 16.0.0-alpha.12 react-native: 0.48.3 => 0.48.3

Steps to Reproduce

  1. Create any VirtualizedList and add a getItemLayout handler.
  2. Start an Animated.Loop animated.
  3. Scroll the list.

Expected Behavior

I would expect the new cells to render.

Actual Behavior

New cells do not render, only the cells that rendered initially are visible.

Reproducible Demo

https://snack.expo.io/H18xSNvi-

Comments

I believe part of the issue lies in _scheduleCellsToRenderUpdate: https://github.com/facebook/react-native/blob/3649fce12916f81a55be953dd14946d6101e71fa/Libraries/Lists/VirtualizedList.js#L1090-L1099. When scrolling, cell updates are scheduled and never called. Adding useNativeDriver: true to the child animation doesn’t seem to help.

Removing the getItemLayout handler causes the list to calculate an averageCellLength. Now, the cell updates aren’t scheduled but rendered immediately. Perhaps if a getItemLayout handler is provided an averageCellLength could be calculated which would let hiPri updates be rendered immediately.

Thanks

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
janicduplessiscommented, Sep 29, 2017

VirtualizedList is probably using InteractionManager to schedule work but get’s blocked by your looping animation. You can add isInteraction: false to your animation config and it should fix the issue.

0reactions
rawrmaancommented, Sep 29, 2017

@willdawsonme I submitted a doc update in #16136.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Animated - React Native
In addition, loops can prevent VirtualizedList -based components from rendering more rows while the animation is running. You can pass ...
Read more >
React Native: Prevent animation from blocking app?
loops can prevent VirtualizedList-based components from rendering more rows ... Thus, updating the animation like so fixes this headache:
Read more >
Animations · React Native
When an animation is running, it can prevent VirtualizedList components from rendering more rows. If you need to run a long or looping...
Read more >
Animation Properties - 2018 - SOLIDWORKS Visualize Help
Displays the animation name. Loop, Sets the looping behavior: Stops after one loop of animation. Repeats animation loop indefinitely.
Read more >
React Native Looping Animation Animated - ADocLib
Will loop without blocking the JS thread if the child animation is set to useNativeDriver: true. In addition loops can prevent VirtualizedList.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found