fix(banner): 이미지가 2장씩 넘어가는 버그 수정
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user