fix(banner): 이미지가 2장씩 넘어가는 버그 수정

This commit is contained in:
Yu Sung
2025-11-20 18:08:54 +09:00
parent 001f161fc5
commit 90b6dfb498
5 changed files with 5 additions and 51 deletions

View File

@@ -79,11 +79,10 @@ private struct AutoSlideCharacterBannerPage: View {
let width: CGFloat
let height: CGFloat
let onTap: (CharacterBannerResponse) -> Void
@State private var boundURL: URL?
var body: some View {
Group {
if let boundURL {
if let boundURL = URL(string: item.imageUrl.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? item.imageUrl){
DownsampledKFImage(
url: boundURL,
size: CGSize(width: width, height: height)
@@ -96,14 +95,5 @@ private struct AutoSlideCharacterBannerPage: View {
}
.contentShape(Rectangle())
.onTapGesture { onTap(item) }
.onAppear {
let encoded = item.imageUrl.addingPercentEncoding(
withAllowedCharacters: .urlQueryAllowed
) ?? item.imageUrl
boundURL = URL(string: encoded)
}
.onDisappear {
boundURL = nil
}
}
}