Skip to content

Commit f198235

Browse files
authored
Merge pull request #2144 from woocommerce/issue/1713-fix-images-scrollback-on-update
Product images header shouldn't scroll back on image status updates
2 parents 1ca6bcc + 8b570f3 commit f198235

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

WooCommerce/Classes/ViewRelated/Products/Cells/Product Images/ProductImagesHeaderTableViewCell.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ final class ProductImagesHeaderTableViewCell: UITableViewCell {
2121
///
2222
var onAddImage: (() -> Void)?
2323

24+
/// Keeps track of the cell config to update collection view layout on change.
25+
///
26+
private var config: ProductImagesCellConfig?
27+
2428
override func awakeFromNib() {
2529
super.awakeFromNib()
2630

@@ -120,6 +124,13 @@ private extension ProductImagesHeaderTableViewCell {
120124
collectionView.dataSource = dataSource
121125
collectionView.backgroundColor = .systemColor(.secondarySystemGroupedBackground)
122126
collectionView.showsHorizontalScrollIndicator = false
127+
128+
guard config != self.config else {
129+
return
130+
}
131+
132+
self.config = config
133+
123134
switch config {
124135
case .extendedAddImages:
125136
collectionView.collectionViewLayout = ProductImagesFlowLayout(itemSize: frame.size, config: config)

0 commit comments

Comments
 (0)