Closed ansh closed 1 year ago
This is expected behavior. Check out my article about skeletons and how to use them with lists:
The example that you gave in the article will work if the component is defined to handle the loading state. In my case, the renderItem lives inside the same file as the FlatList, allowing such a structure to not be possible as I cannot call that component. I guess I can refactor my code and I understand that solving for every use-case might be outside the scope of this library.
Thanks! I'll close this now.
It would be pretty easy to use with FlatList too. The article gives the idea you’d need. You could just render a different FlatList if data is undefined with an array of numbers as its data prop.
Yes, that is what I am doing. Definitely more code than your original example so was hoping for something like that, but this is amazing too. ;)
You could also just use my loading example without a flatlist for the loading state. It isn’t necessary to scroll a skeleton.
Yes, both work! Thank you :) However, now I am facing another issue #251
Is there an existing issue for this?
Current Behavior
Right now, if you have a FlatList, and wrap the whole thing with a Skeleton, the loader shows one small square since the FlatList data has not yet bee fulfilled.
However, if you wrap individual items (inside renderItem) with Skeleton, it doesn't work as the data is not loaded so the FlatList shows the empty component while loading is happening.
Expected Behavior
A simple way to wrap a FlatList renderItem or whole FlatList and have Skeleton loading.
Steps To Reproduce
No response
Versions
Screenshots
No response
Reproduction