Skip to content

Commit 83b0670

Browse files
authored
Fix a regression where you can't scroll the timeline on iOS 17 (#3320)
It was caused by a fix for the same bug on iOS 18 🤦‍♂️
1 parent 69009a8 commit 83b0670

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

ElementX/Sources/Screens/RoomScreen/View/SwipeRightAction.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct SwipeRightAction<Label: View>: ViewModifier {
3131
content
3232
.offset(x: xOffset, y: 0.0)
3333
.animation(.interactiveSpring().speed(0.5), value: xOffset)
34-
.simultaneousGesture(gesture)
34+
.timelineGesture(gesture)
3535
.onChange(of: dragGestureActive) { value in
3636
if value == true {
3737
if shouldStartAction() {
@@ -113,6 +113,18 @@ extension View {
113113
action: @escaping () -> Void) -> some View {
114114
modifier(SwipeRightAction(label: label, shouldStartAction: shouldStartAction, action: action))
115115
}
116+
117+
@ViewBuilder
118+
fileprivate func timelineGesture(_ gesture: some Gesture) -> some View {
119+
if #available(iOS 18.0, *) {
120+
// iOS 18 has a bug https://forums.developer.apple.com/forums/thread/760035 and you
121+
// can't scroll the timeline when `gesture` is used.
122+
simultaneousGesture(gesture)
123+
} else {
124+
// Equally on iOS 17 you can't scroll the timeline when `simultaneousGesture` is used.
125+
self.gesture(gesture)
126+
}
127+
}
116128
}
117129

118130
struct SwipeRightAction_Previews: PreviewProvider, TestablePreview {

0 commit comments

Comments
 (0)