Fix add gifts load more

This commit is contained in:
Ilya Laktyushin 2025-07-23 22:37:01 +02:00
parent b9a2af1e97
commit 55e96a5a30

View File

@ -101,10 +101,10 @@ final class AddGiftsScreenComponent: Component {
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
self.updateScrolling(transition: .immediate)
self.updateScrolling(interactive: true, transition: .immediate)
}
private func updateScrolling(transition: ComponentTransition) {
private func updateScrolling(interactive: Bool = false, transition: ComponentTransition) {
guard let environment = self.environment, let giftsListView = self.giftsListView else {
return
}
@ -120,6 +120,11 @@ final class AddGiftsScreenComponent: Component {
if self.scrollView.contentSize != contentSize {
self.scrollView.contentSize = contentSize
}
let bottomContentOffset = max(0.0, self.scrollNode.view.contentSize.height - self.scrollNode.view.contentOffset.y - self.scrollNode.view.frame.height)
if interactive, bottomContentOffset < 200.0 {
self.giftsListView.loadMore()
}
}
func update(component: AddGiftsScreenComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<EnvironmentType>, transition: ComponentTransition) -> CGSize {