Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a regression where you can't scroll the timeline on iOS 17 #3320

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct SwipeRightAction<Label: View>: ViewModifier {
content
.offset(x: xOffset, y: 0.0)
.animation(.interactiveSpring().speed(0.5), value: xOffset)
.simultaneousGesture(gesture)
.timelineGesture(gesture)
.onChange(of: dragGestureActive) { value in
if value == true {
if shouldStartAction() {
Expand Down Expand Up @@ -113,6 +113,18 @@ extension View {
action: @escaping () -> Void) -> some View {
modifier(SwipeRightAction(label: label, shouldStartAction: shouldStartAction, action: action))
}

@ViewBuilder
fileprivate func timelineGesture(_ gesture: some Gesture) -> some View {
if #available(iOS 18.0, *) {
// iOS 18 has a bug https://forums.developer.apple.com/forums/thread/760035 and you
// can't scroll the timeline when `gesture` is used.
simultaneousGesture(gesture)
} else {
// Equally on iOS 17 you can't scroll the timeline when `simultaneousGesture` is used.
self.gesture(gesture)
}
}
}

struct SwipeRightAction_Previews: PreviewProvider, TestablePreview {
Expand Down
Loading