fix pagination load
This commit is contained in:
parent
526a57b556
commit
8568f6c20e
@ -80,10 +80,10 @@ struct BlockedUsersView: View {
|
|||||||
|
|
||||||
private var usersSection: some View {
|
private var usersSection: some View {
|
||||||
Section(header: Text(NSLocalizedString("Заблокированные", comment: ""))) {
|
Section(header: Text(NSLocalizedString("Заблокированные", comment: ""))) {
|
||||||
ForEach(blockedUsers) { user in
|
ForEach(Array(blockedUsers.enumerated()), id: \.element.id) { index, user in
|
||||||
userRow(user)
|
userRow(user, index: index)
|
||||||
}
|
}
|
||||||
if isLoading {
|
if isLoading && !blockedUsers.isEmpty {
|
||||||
Text("Идет загрузка...")
|
Text("Идет загрузка...")
|
||||||
.foregroundColor(.gray)
|
.foregroundColor(.gray)
|
||||||
.frame(maxWidth: .infinity, alignment: .center)
|
.frame(maxWidth: .infinity, alignment: .center)
|
||||||
@ -99,7 +99,7 @@ struct BlockedUsersView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func userRow(_ user: BlockedUser) -> some View {
|
private func userRow(_ user: BlockedUser, index: Int) -> some View {
|
||||||
HStack(spacing: 12) {
|
HStack(spacing: 12) {
|
||||||
Circle()
|
Circle()
|
||||||
.fill(Color.accentColor.opacity(0.15))
|
.fill(Color.accentColor.opacity(0.15))
|
||||||
@ -131,7 +131,7 @@ struct BlockedUsersView: View {
|
|||||||
.disabled(removingUserIds.contains(user.id))
|
.disabled(removingUserIds.contains(user.id))
|
||||||
}
|
}
|
||||||
.onAppear {
|
.onAppear {
|
||||||
if user.id == blockedUsers.last?.id {
|
if index >= blockedUsers.count - 5 {
|
||||||
Task {
|
Task {
|
||||||
await loadBlockedUsers()
|
await loadBlockedUsers()
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user