Digital PCT265 story ONEAPP-7249 - Prevent forcing immediate layouts on cell changes which causes scroll stagger and carousel width double layouts.

This commit is contained in:
Hedden, Kyle Matthew 2024-04-25 19:34:36 -04:00
parent 35088ae446
commit c5dd5ed4e7
3 changed files with 7 additions and 7 deletions

View File

@ -134,7 +134,7 @@
} }
update(cell: cell, size: view.frame.width) update(cell: cell, size: view.frame.width)
// Neded to fix an apple defect where the cell is not the correct size on certain devices for certain cells // Neded to fix an apple defect where the cell is not the correct size on certain devices for certain cells
cell.layoutIfNeeded() cell.setNeedsLayout()
return cell return cell
} }

View File

@ -169,7 +169,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
} }
(cell as? MVMCoreViewProtocol)?.updateView(tableView.bounds.width) (cell as? MVMCoreViewProtocol)?.updateView(tableView.bounds.width)
// Neded to fix an apple defect where the cell is not the correct size on certain devices for certain cells // Neded to fix an apple defect where the cell is not the correct size on certain devices for certain cells
cell.layoutIfNeeded() cell.setNeedsLayout()
return cell return cell
} }
@ -353,7 +353,7 @@ extension MoleculeListTemplate: MoleculeListProtocol {
indexPaths.count > 0 else { return } indexPaths.count > 0 else { return }
tableView?.deleteRows(at: indexPaths, with: animation) tableView?.deleteRows(at: indexPaths, with: animation)
updateViewConstraints() updateViewConstraints()
view.layoutIfNeeded() view.setNeedsLayout()
} }
public func addMolecules(_ molecules: [ListItemModelProtocol & MoleculeModelProtocol], indexPath: IndexPath, animation: UITableView.RowAnimation?) { public func addMolecules(_ molecules: [ListItemModelProtocol & MoleculeModelProtocol], indexPath: IndexPath, animation: UITableView.RowAnimation?) {
@ -372,7 +372,7 @@ extension MoleculeListTemplate: MoleculeListProtocol {
indexPaths.count > 0 else { return } indexPaths.count > 0 else { return }
self.tableView?.insertRows(at: indexPaths, with: animation) self.tableView?.insertRows(at: indexPaths, with: animation)
self.updateViewConstraints() self.updateViewConstraints()
self.view.layoutIfNeeded() self.view.setNeedsLayout()
} }
public func swapMolecules(_ molecules: [ListItemModelProtocol & MoleculeModelProtocol], with replacements: [ListItemModelProtocol & MoleculeModelProtocol], at indexPath: IndexPath, animation: UITableView.RowAnimation?) { public func swapMolecules(_ molecules: [ListItemModelProtocol & MoleculeModelProtocol], with replacements: [ListItemModelProtocol & MoleculeModelProtocol], at indexPath: IndexPath, animation: UITableView.RowAnimation?) {
@ -420,7 +420,7 @@ extension MoleculeListTemplate: MoleculeListProtocol {
tableView.endUpdates() tableView.endUpdates()
self.updateViewConstraints() self.updateViewConstraints()
self.view.layoutIfNeeded() self.view.setNeedsLayout()
} }
public func getIndexPath(for molecule: ListItemModelProtocol & MoleculeModelProtocol) -> IndexPath? { public func getIndexPath(for molecule: ListItemModelProtocol & MoleculeModelProtocol) -> IndexPath? {

View File

@ -112,7 +112,7 @@ open class SectionListTemplate: MoleculeListTemplate {
(header as? MoleculeViewProtocol)?.set(with: headerInfo.molecule, delegateObjectIVar, nil) (header as? MoleculeViewProtocol)?.set(with: headerInfo.molecule, delegateObjectIVar, nil)
(header as? MVMCoreViewProtocol)?.updateView(tableView.bounds.width) (header as? MVMCoreViewProtocol)?.updateView(tableView.bounds.width)
// Neded to fix an apple defect where the cell is not the correct size on certain devices for certain cells // Neded to fix an apple defect where the cell is not the correct size on certain devices for certain cells
header?.layoutIfNeeded() header?.setNeedsLayout()
return header return header
} }
@ -126,7 +126,7 @@ open class SectionListTemplate: MoleculeListTemplate {
(footer as? MoleculeViewProtocol)?.set(with: footerInfo.molecule, delegateObjectIVar, nil) (footer as? MoleculeViewProtocol)?.set(with: footerInfo.molecule, delegateObjectIVar, nil)
(footer as? MVMCoreViewProtocol)?.updateView(tableView.bounds.width) (footer as? MVMCoreViewProtocol)?.updateView(tableView.bounds.width)
// Neded to fix an apple defect where the cell is not the correct size on certain devices for certain cells // Neded to fix an apple defect where the cell is not the correct size on certain devices for certain cells
footer?.layoutIfNeeded() footer?.setNeedsLayout()
return footer return footer
} }