ra1028 / Carbon

🚴 A declarative library for building component-based user interfaces in UITableView and UICollectionView.

Home Page:https://ra1028.github.io/Carbon

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Keep UITableView ContentOffset to prepend list items

shimastripe opened this issue · comments

Checklist

Expected Behavior

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

  • When I continue to load the latest items and append the Component Items in List, UITableView contentOffset works properly. (= keep the current position)
  • When I pull to refresh and prepend Component items in List, UITableView contentOffset moves to top position in List.

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)

  • I want to resolve latter case. (add to prepend items)
    • UITableView's contentOffset should indicate Component3.
  • Do you have any solutions? Thank you.

Environment

  • Carbon version:
    1.0.0 Release Candidate 6

  • Swift version:
    Apple Swift version 5.2 (swiftlang-1103.0.32.1 clang-1103.0.32.29)

  • iOS version:
    13.4.1

  • Xcode version:
    11.4.1

  • Devices/Simulators:
    iPhone11Pro 13.4.1

  • using SPM

@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.

@ra1028

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

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