Skip to content

Commit

Permalink
Update BPKCarouselCard.swift (#2042)
Browse files Browse the repository at this point in the history
Co-authored-by: Mathew Reynolds <[email protected]>
  • Loading branch information
mattyr3200 and Mathew Reynolds authored Aug 7, 2024
1 parent 490a7bd commit 01813a1
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions Backpack-SwiftUI/CarouselCard/Classes/BPKCarouselCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,27 @@ public struct BPKCarouselCard<Content: View>: View {
self.title = title
self.description = description
self.contentAccessibilityLabel = contentAccessibilityLabel
UIScrollView.appearance().bounces = false
}

public var body: some View {
GeometryReader { reader in
ScrollView {
cardContent(reader: reader)
Group {
if #available(iOS 16.4, *) {
ScrollView {
cardContent(reader: reader)
}
.scrollBounceBehavior(.basedOnSize, axes: [.vertical])
} else {
ScrollView {
cardContent(reader: reader)
}
.onAppear(perform: {
UIScrollView.appearance().bounces = false
})
.onDisappear(perform: {
UIScrollView.appearance().bounces = true
})
}
}
.background(.white.darkVariant(.badgeBackgroundNormalColor))
.clipShape(RoundedRectangle(cornerRadius: .lg))
Expand Down

0 comments on commit 01813a1

Please sign in to comment.