Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

ASTableNode will scroll to the top after insert rows #3348

Open
IvanChan opened this issue Apr 2, 2019 · 0 comments
Open

ASTableNode will scroll to the top after insert rows #3348

IvanChan opened this issue Apr 2, 2019 · 0 comments

Comments

@IvanChan
Copy link

IvanChan commented Apr 2, 2019

AsdkDEMO.zip

Very simple demo

  1. load some data, like from 40 - 100
  2. and then insert rows at the beginning, 0- 39
  3. the ASTableNode just jump to the top after the insertion

The insertion code like below, I try to scroll after insertion, in demo seems ok, but my project got a much more complicated cell & safeAreaInset, its totally disaster

// Table scroll to the top after insert
    self.tableNode.insertRows(at: newIndexPaths, with: .none)

// This workaround looks ok just because the cell is simple in layout & rendering
     self.tableNode.performBatch(animated: false, updates: {
          self.tableNode.insertRows(at: newIndexPaths, with: .none)
      }, completion: { (finished) in
          self.tableNode.scrollToRow(at: newIndexPaths.last!, at: .top, animated: false)
      })
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant