Skip to content

Commit

Permalink
fix: add initial total rows
Browse files Browse the repository at this point in the history
  • Loading branch information
vcellu committed Jul 29, 2022
1 parent 4147cea commit 82cd504
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions ios/ContainerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,12 @@ class ContainerView: UIView {
collectionView?.totalCellsView = view
if let dataSize = dataSize {
view.totalRows = dataSize.qcy ?? 0
if let collectionView = collectionView {
DispatchQueue.main.async {
// your stuff here executing after collectionView has been layouted
collectionView.signalVisibleRows()
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion ios/DataCollectionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ class DataCollectionView: UIView, UICollectionViewDataSource, UICollectionViewDe
uiCollectionView.register(DataCellView.self, forCellWithReuseIdentifier: reuseIdentifier)
uiCollectionView.delegate = self
uiCollectionView.dataSource = self
// uiCollectionView.sco
uiCollectionView.indicatorStyle = .black
uiCollectionView.backgroundColor = .white
childCollectionView = uiCollectionView
Expand All @@ -116,6 +115,7 @@ class DataCollectionView: UIView, UICollectionViewDataSource, UICollectionViewDe
let left = uiCollectionView.leftAnchor.constraint(equalTo: self.leftAnchor)
let right = uiCollectionView.rightAnchor.constraint(equalTo: self.rightAnchor)
self.addConstraints([top, bottom, left, right])
signalVisibleRows()

}

Expand Down
3 changes: 2 additions & 1 deletion ios/TotalCellsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ class TotalCellsView : UIView {
addSubview(view)
self.textView = view;
}

func updateTotals(first:IndexPath, last: IndexPath) {
if let textView = textView {
if let f = first.last, let l = last.last {
textView.text = " \(f) - \(l) of \(totalRows)"
textView.text = "\(f) - \(l) of \(totalRows)"
}
}
}
Expand Down

0 comments on commit 82cd504

Please sign in to comment.