[ReactNative] this.virtualRenderer not always initialized in RecyclerListView
See original GitHub issueFirst of all, thanks a lot for creating this great list view component. The built in FlatList and SectionList components of react-native are pretty bad at handling initial scrollOffsets, where this component really shines (especially with ContextProvider).
I found a bug where new props lead to exceptions through the componentWillReceiveProps call in RecyclerListView:
When the RecyclerListViews parent is re-rendered early after being mounted, the RecyclerListView’s componentWillReceiveProps is called, but this.virtualizedRenderer is not yet initialized. This will lead to two exceptions in the following lines:
As a quick fix, I wrapped both lines in an if (this.virtualRenderer) { ... }
and there are no more exceptions or weird behavior.
You can try out the following sample to reproduce the bug:
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:16
Top GitHub Comments
Even if I rendered the RecyclerListView after I load the data. I’d still have to imperatively scroll to the desired index, which will break because of #44. Thanks for the suggestion though.
cross-platform@flipkart.com is public now… it should be working… can you try now? If it doesn’t please DM me on twitter… I’ll pass on the email there.