Toggling visibility on items leaving empty space
Heya,
using the window scroll, i'm trying to implement visibility toggle.
What i have for data is a flattened tree and when i want to hide children of some node looks like it doesn't recalculate the positions of elements that are below the collapsed node so i'm left with blank space. What i've tried so far:
- skip rendering row by returning null based on visibility flag
- conditionally returning 0 for size in estimateSize
- doing same thing in measureElement
- combinations of all of the above
None of those work and i'm always left with blank space where the hidden rows are.
Went through all the github issues that could be related to that but nothing works.
Any help or hint highly appreciated.
2 Replies
blank-aquamarine•2y ago
@nekru imho conditionally returning 0 in estimateSize should work, one caveats here that estimateSize will not trigger recalculation of measurements, as it's not part of memo, this can be done via getItemKey dependencies. If you could create an sandbox example, will have a look
cc @marlin as this looks like same issue
mute-goldOP•2y ago
oh nice,
getItemKey
did the trick, thanks a lot.