From 73a5c52fd21ed8973748d7406c2edd8b168b0a05 Mon Sep 17 00:00:00 2001 From: Vittorio Cellucci Date: Tue, 31 Jan 2023 13:22:28 -0500 Subject: [PATCH] fix: invalid row counts (#184) Co-authored-by: Vittorio Cellucci --- ios/ContainerView.swift | 7 ++----- ios/DataCollectionView.swift | 5 +++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ios/ContainerView.swift b/ios/ContainerView.swift index f61f4d55..61cae771 100644 --- a/ios/ContainerView.swift +++ b/ios/ContainerView.swift @@ -123,12 +123,9 @@ class ContainerView: UIView { NotificationCenter.default.post(name: Notification.Name.onClearSelectionBand, object: nil) let json = try JSONSerialization.data(withJSONObject: rows) let decodedRows = try JSONDecoder().decode(RowsObject.self, from: json) - let dataRowsEmpty = decodedRows.rows?.isEmpty ?? true - if(dataRowsEmpty) { - return - } + - if(dataRows != nil && dataRows?[0].cells.count != decodedRows.rows?[0].cells.count) { + if(dataRows != nil && decodedRows.rows?.count != 0 && dataRows?.count != 0 && dataRows?[0].cells.count != decodedRows.rows?[0].cells.count) { return } if dataRows == nil || decodedRows.reset == true { diff --git a/ios/DataCollectionView.swift b/ios/DataCollectionView.swift index a848d4b6..6fc02082 100644 --- a/ios/DataCollectionView.swift +++ b/ios/DataCollectionView.swift @@ -88,6 +88,11 @@ class DataCollectionView: UIView, UICollectionViewDataSource, UICollectionViewDe } func scrollToTop() { + if let dataRows = dataRows { + if dataRows.isEmpty { + return + } + } if let childCollectionView = childCollectionView { childCollectionView.scrollToItem(at: IndexPath(item: 0, section: 0), at: .top, animated: true) }