Fix player dismiss gesture stuck after panel dismiss with comments expanded

Reset isCommentsExpanded and commentsFrame on the NavigationCoordinator
directly when the portrait panel is dismissed, since PortraitDetailsPanel
owns its own @State that doesn't sync back through .onChange during dismiss.
Also track comments overlay frame via GeometryReader so the dismiss gesture
can allow swipes outside the comments area instead of blanket-blocking.
This commit is contained in:
Arkadiusz Fal
2026-02-12 04:42:32 +01:00
parent b6b6d280e1
commit 6c30e745d9
7 changed files with 76 additions and 2 deletions

View File

@@ -269,6 +269,23 @@ struct ExpandedPlayerSheet: View {
}
.opacity(isVisible ? 1 : 0)
.allowsHitTesting(isVisible)
.background(
GeometryReader { commentsGeometry in
Color.clear
.onChange(of: commentsGeometry.frame(in: .global)) { _, newFrame in
if isCommentsExpanded {
navigationCoordinator?.commentsFrame = newFrame
}
}
.onChange(of: isCommentsExpanded) { _, expanded in
if expanded {
navigationCoordinator?.commentsFrame = commentsGeometry.frame(in: .global)
} else {
navigationCoordinator?.commentsFrame = .zero
}
}
}
)
}
.ignoresSafeArea(edges: .bottom)
}
@@ -770,6 +787,7 @@ private struct PlayerEventHandlersModifier: ViewModifier {
playerState?.commentsState = .idle
playerState?.commentsContinuation = nil
isCommentsExpanded = false
navigationCoordinator?.commentsFrame = .zero
isPanelExpanded = false
panelExpandOffset = 0
}