-
Notifications
You must be signed in to change notification settings - Fork 38
Description
I may have misunderstood what's happening here, but hopefully a video demo will help show what the issue is. Essentially when I swipe on a page, I can see the next page, but when I stop swiping the pages just stay in the half-transitioned state instead of snapping to either the new or current page based on the threshold.
import PageView
import SwiftUI
public struct ImageCarouselView: View {
let imageURLs: [URL]
@State private var index: Int = 0
public var body: some View {
HPageView(selectedPage: $index, data: imageURLs) { imageURL in
CachedImage(imageURL) // Kingfisher image view
// Text(imageURL.absoluteString) // Same problem
}
}
}
// For the purposes of demonstration code
extension URL: Identifiable {
var id: String { absoluteString }
}ImageCarouselView(imageURLs: imageURLs)
.frame(width: width, height: width * 4 / 3)As far as I can tell from the docs this should work as-is. I've tried passing each of the different pageGestureTypes to the constructor, and also tried some extreme settings for pageSwitchThreshold (0.1 and 0.9), but neither of these seems to have any effect.
I thought that there could be some issue with an interactor above this component in the view hierarchy, but there's nothing obvious that stands out to me, and I'm not quite sure what to look for. This view originally had an onTapGesture handler on it, but I removed that to narrow down the problem.
Here's a video of the issue. It's from the simulator for ease of recording, but the same behaviour happens on a real device.
Simulator.Screen.Recording.-.iPhone.13.-.2021-10-22.at.12.43.12.mov
iOS: 14.5, Xcode: 13.0. PageView: 1.5.0
Happy to provide any more information that may help diagnose this!