babylonhealth / Bento

Swift library for building component-based interfaces on top of UITableView and UICollectionView 🍱

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Glitch with delete animation

sergdort opened this issue · comments

Description

It seems like there is an issue with delete animation if the state of the table view changes quickly (e.g during the delete transition transition)

Proposed solution

make delete call on the component after transaction finishes

        sections[indexPath.section].items.remove(at: indexPath.row)
        CATransaction.begin()
        CATransaction.setCompletionBlock {
            component.delete()
        }
        actionPerformed?(true)
        tableView?.deleteRows(at: [indexPath], with: .left)
        CATransaction.commit()
Before After
delete_before delete

TBH I can't see much of a difference / improvement 🤷🏼‍♀️

@mluisbrown look at the row that is being removed

#50 resolves common scenarios that are affected, but some edge cases are not handled.