sghiassy / react-native-sglistview

SGListView is a memory minded implementation of React Native's ListView
MIT License
743 stars 72 forks source link

Improve handling of large rows #9

Closed udfalkso closed 8 years ago

udfalkso commented 9 years ago

Our app has list items that are quite large and are often larger than the screen height. In this case, it seems that the premptive loading was not functioning correctly, leading to lots of flickering and flashing.

This PR attempts to better handle this case. Performance in our case definitely seems improved, and I did some quick trials with smaller rows and they also seem to work well. I do still see some flashing issues when scrolling up, not quite sure why though.

Highlights:

That's all I've got for now. Hope this is helpful to some. Thanks again for this great Component!!

udfalkso commented 9 years ago

I just found a case that's still off... after scrolling down some, then scrolling all the way to top via status bar tap, the preemptive loading stops working when scrolling down again. Likely because the array still full and didn't get popped via visible change because scroll-up was so fast.

It probably worked ok before because the premptive list just got larger, which is maybe ok, but there needs to be some nice way to clean things up in this kind of scenario. Will try come up with something.

udfalkso commented 9 years ago

Ok, latest commit seems to work quite well! Take a look when you get a chance, thanks.

sghiassy commented 9 years ago

cool beans - I'll take a look later today

udfalkso commented 9 years ago

I was still finding that occasionally some visible rows would totally vanish.

This new version simplifies the code a bit and seems to improve perceived performance, at the expense of keeping a few rows in both scrolling directions premptively visible.

sghiassy commented 9 years ago

I'm going to run some more tests later tonight. So far so good.

Also, if you have time check out PR: https://github.com/sghiassy/react-native-sglistview/pull/10. The 1d-interval-tree seems like a better data-structure for the job and could solve your problem as well.

udfalkso commented 9 years ago

Yeah, I've played with @rreusser's version and it seems to perform nicely without any of the occasional glitches that I'm getting here. Probably better to pursue that avenue...