airbnb / infinity

UITableViews for the web (DEPRECATED)
http://airbnb.io/infinity/
Other
2.8k stars 281 forks source link

Added support to turn off repartitioning on resize #20

Closed saiwong closed 7 years ago

saiwong commented 11 years ago

Repartitioning is called unnecessarily due to the window being faux resized whenever an item is added to the ListView on a mobile web device.

To work around this issue, an option is added to disable this functionality.

reissbaker commented 11 years ago

Hm. What happens when the mobile device is rotated? Seems like it would break, because the window is actually having its size changed.

Removing repartition calls is something worth working for, but I think the future of that is changing the internal data structure from a sorted array to a balanced binary tree, which will remove repartition entirely.

saiwong commented 11 years ago

The real issue that this is trying to fix is that for some odd reason that I haven't spent the time to identify, when items are prepended (#10), the size of the window is changed and repartitionPage is called. However, after the call, the prepended item changes it position to the bottom! It doesn't quite make sense and requires more investigation.

On the flip side, for the mobile web world, the change in orientation will cause a resize and possibly that event should be binded on instead of simply a resize. I will look into adding that for mobile environments.

reissbaker commented 11 years ago

Heh. Think I know why that's happening. See my comment re: coordinate caching on #16. prepend is calling updateCoords with listItem as the first arg, but listView.height as the second, even in the case of a prepend. For prepends, it should pass 0 as the second arg -- since by definition a prepended item is offset from its parent by zero.

saiwong commented 11 years ago

Repartitioning issue is fixed on #16. I still think that the mobile web use case needs to be resolved due to the weird fact that the resize event fires as the page grows in size! This would be a huge detriment for performance and does not correctly reflect what is going on.

Need to think about how to handle this case instead. Hopefully the solution will not need to involve mobile browser detection.

ljharb commented 7 years ago

This project is no longer maintained, and is deprecated.