Shopify / FunctionalTableData

Declarative UITableViewDataSource implementation
MIT License
365 stars 30 forks source link

Unhighlight cell on deselection. #202

Closed antonino-u closed 3 years ago

antonino-u commented 3 years ago

Because of our custom selection logic for UITableView, cells that are selected are usually also highlighted using CellStyler. The problem comes when gestures are used for multi-selection, or accessory view are tapped when in multi-selection, the last selected cell is always set as the highlighted cell. When using gestures or tapping the accessory view, the normal flow of shouldHighlightCellAt is not called, meaning that the cell does not properly un-highlight. This PR simply adds logic to say: when a cell is de-selected, if it is still highlighted, unhighlight it. In almost all cases except multi-select, this would have no effect because the cell is highlighted and un-highlighted before it is selected or de-selected.

antonino-u commented 3 years ago

Given what I said here and that this is a super simple PR and that @schmidyy has approved it, I am merging this.