Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 6 additions & 3 deletions Sources/FlowStack/FlowTransition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,15 @@ extension AnyTransition {

content
.onInteractiveDismissGesture(threshold: 80, isEnabled: !isDisabled, isDismissing: isDismissing, swipeUpToDismiss: context.swipeUpToDismiss, onDismiss: {
defer { isDismissing = true }
guard !isDisabled else { return }
dismiss()
isDismissing = true
}, onPan: { offset in
snapCornerRadiusZero = false
isEnded = false
panOffset = offset
defer { self.isEnded = false }
guard !isDisabled else { return }
self.snapCornerRadiusZero = false
self.panOffset = offset
}, onEnded: { isDismissing in
// TODO: FS-34: Handle snap corner radius 0 on interactive dismiss cancel
withTransaction(transaction) {
Expand Down
6 changes: 3 additions & 3 deletions Sources/FlowStack/View+InteractiveDismiss.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ class InteractiveDismissCoordinator: NSObject, ObservableObject, UIGestureRecogn
var onPan: (CGPoint) -> Void
var isEnabled: Bool {
didSet {
panGestureRecognizer.isEnabled = isEnabled
edgeGestureRecognizer.isEnabled = isEnabled
panGestureRecognizer.isEnabled = true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👆 If we aren't modifying these, should they even be set here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zac It's no longer needed! Good catch

edgeGestureRecognizer.isEnabled = true
}
}
var isDismissing: Bool {
Expand Down Expand Up @@ -223,7 +223,7 @@ class InteractiveDismissCoordinator: NSObject, ObservableObject, UIGestureRecogn
onPan(offset)

let shouldDismiss = offset.y > threshold || (offset.x > threshold && isEdge) || (-offset.y > threshold * 2 && swipeUpToDismiss)
if shouldDismiss != isPastThreshold && shouldDismiss {
if shouldDismiss != isPastThreshold && shouldDismiss, isEnabled {
impactGenerator.impactOccurred()
}

Expand Down