feat(chat): Talk 탭에 스크롤 페이지네이션 추가
This commit is contained in:
@@ -19,9 +19,9 @@ struct TalkView: View {
|
||||
.foregroundColor(.white)
|
||||
} else {
|
||||
ScrollView(.vertical, showsIndicators: false) {
|
||||
VStack(spacing: 24) {
|
||||
ForEach(0..<viewModel.talkRooms.count, id: \.self) {
|
||||
let item = viewModel.talkRooms[$0]
|
||||
LazyVStack(spacing: 24) {
|
||||
ForEach(0..<viewModel.talkRooms.count, id: \.self) { index in
|
||||
let item = viewModel.talkRooms[index]
|
||||
TalkItemView(item: item)
|
||||
.padding(.horizontal, 24)
|
||||
.contentShape(Rectangle())
|
||||
@@ -31,6 +31,17 @@ struct TalkView: View {
|
||||
step: .chatRoom(id: item.chatRoomId)
|
||||
)
|
||||
}
|
||||
.onAppear {
|
||||
// 마지막 셀 등장 시 다음 페이지 로드
|
||||
if index == viewModel.talkRooms.count - 1 {
|
||||
viewModel.loadNextPage()
|
||||
}
|
||||
}
|
||||
}
|
||||
if viewModel.isLoadingMore {
|
||||
ProgressView()
|
||||
.progressViewStyle(CircularProgressViewStyle(tint: .white))
|
||||
.padding(.vertical, 12)
|
||||
}
|
||||
}
|
||||
.padding(.vertical, 24)
|
||||
|
||||
Reference in New Issue
Block a user