ra1028 / Carbon

🚴 A declarative library for building component-based user interfaces in UITableView and UICollectionView.
https://ra1028.github.io/Carbon
Apache License 2.0
1.33k stars 97 forks source link

Keep UITableView ContentOffset to prepend list items #76

Closed shimastripe closed 4 years ago

shimastripe commented 4 years ago

Checklist

Expected Behavior

I want to make a timeline like Twitter using Carbon and UITableView.

Current Behavior

Add to append items.

list = [Component3, Component4, Component5]
appendItems = [Component6, Component7]

I scroll to the latest item Component5.

newList = [Component3, Component4, Component5, Component6, Component7]

and UITableView's contentOffset indicates Component5. Keep current position.

Add to prepend items.

list = [Component3, Component4, Component5]
appendItems = [Component1, Component2]

I pull to refresh.

newList = [Component1, Component2, Component3, Component4, Component5]

and UITableView's contentOffset indicates Component1. Not Component3

Detailed Description (Include Screenshots)

Environment

ra1028 commented 4 years ago

@shimastripe Sorry for my late reply. Carbon provides powerful features but is actually a thin wrapper for UITable/CollectionView. So there are no plans for Carbon to support any of the features you have suggested for now. However, you are not limit any solution by Carbon, and I recommend that you implement it according to the existing solution. Unfortunately, I couldn't be helpful.

shimastripe commented 4 years ago

@ra1028

I recommend that you implement it according to the existing solution.

OK, I understand and try it. Thank you for the reply!