Skip to content

Commit

Permalink
Fixes #1918 - Revert 1a12c729de521d2dcb664bed6b19a75ec139bede as #617
Browse files Browse the repository at this point in the history
… is no longer reproducible on iOS 18.
  • Loading branch information
stefanceriu committed Nov 15, 2024
1 parent ef288a9 commit 4496ca2
Showing 1 changed file with 3 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -412,19 +412,17 @@ class NavigationSplitCoordinator: CoordinatorProtocol, ObservableObject, CustomS

private struct NavigationSplitCoordinatorView: View {
@State private var columnVisibility = NavigationSplitViewVisibility.all
@State private var isInSplitMode = true

@Environment(\.horizontalSizeClass) private var horizontalSizeClass
@Environment(\.scenePhase) private var scenePhase

@ObservedObject var navigationSplitCoordinator: NavigationSplitCoordinator

var body: some View {
Group {
if isInSplitMode {
navigationSplitView
} else {
if horizontalSizeClass == .compact {
navigationStack
} else {
navigationSplitView
}
}
// This needs to be handled on the top level otherwise sheets
Expand All @@ -450,25 +448,6 @@ private struct NavigationSplitCoordinatorView: View {
.animation(.elementDefault, value: navigationSplitCoordinator.overlayPresentationMode)
.animation(.elementDefault, value: navigationSplitCoordinator.overlayModule)
}
// Handle `horizontalSizeClass` changes breaking the navigation bar
// https://github.com/element-hq/element-x-ios/issues/617
.onChange(of: horizontalSizeClass) { _, newValue in
guard scenePhase != .background else {
return
}

isInSplitMode = newValue == .regular
}
.onChange(of: scenePhase) { _, newValue in
guard newValue == .active else {
return
}

isInSplitMode = horizontalSizeClass == .regular
}
.task {
isInSplitMode = horizontalSizeClass == .regular
}
}

/// The NavigationStack that will be used in compact layouts
Expand Down

0 comments on commit 4496ca2

Please sign in to comment.