mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:12:26 +00:00
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 🤦♂️
This commit is contained in:
@@ -31,7 +31,7 @@ struct SwipeRightAction<Label: View>: ViewModifier {
|
|||||||
content
|
content
|
||||||
.offset(x: xOffset, y: 0.0)
|
.offset(x: xOffset, y: 0.0)
|
||||||
.animation(.interactiveSpring().speed(0.5), value: xOffset)
|
.animation(.interactiveSpring().speed(0.5), value: xOffset)
|
||||||
.simultaneousGesture(gesture)
|
.timelineGesture(gesture)
|
||||||
.onChange(of: dragGestureActive) { value in
|
.onChange(of: dragGestureActive) { value in
|
||||||
if value == true {
|
if value == true {
|
||||||
if shouldStartAction() {
|
if shouldStartAction() {
|
||||||
@@ -113,6 +113,18 @@ extension View {
|
|||||||
action: @escaping () -> Void) -> some View {
|
action: @escaping () -> Void) -> some View {
|
||||||
modifier(SwipeRightAction(label: label, shouldStartAction: shouldStartAction, action: action))
|
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 {
|
struct SwipeRightAction_Previews: PreviewProvider, TestablePreview {
|
||||||
|
|||||||
Reference in New Issue
Block a user