From 9e65c2ff2f3ee0a694a33e764cfcf30f1496bb08 Mon Sep 17 00:00:00 2001 From: Abe White Date: Wed, 28 Feb 2024 12:24:08 -0600 Subject: [PATCH] Fix .sheet presentation after recent update to new Compose BOM --- Sources/SkipUI/SkipUI/Containers/Navigation.swift | 5 ++++- Sources/SkipUI/SkipUI/Layout/Presentation.swift | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/SkipUI/SkipUI/Containers/Navigation.swift b/Sources/SkipUI/SkipUI/Containers/Navigation.swift index 677181e7..3000a183 100644 --- a/Sources/SkipUI/SkipUI/Containers/Navigation.swift +++ b/Sources/SkipUI/SkipUI/Containers/Navigation.swift @@ -102,6 +102,7 @@ public struct NavigationStack : View where Root: View { composable(route: Navigator.rootRoute, exitTransition: { slideOutHorizontally(targetOffsetX: { $0 * (isRTL ? 1 : -1) / 3 }) }, popEnterTransition: { slideInHorizontally(initialOffsetX: { $0 * (isRTL ? 1 : -1) / 3 }) }) { entry in + navigator.value.syncState() if let state = navigator.value.state(for: entry) { let entryContext = context.content(stateSaver: state.stateSaver) ComposeEntry(navController: navController, destinations: destinations, destinationsDidChange: preferencesDidChange, isRoot: true, context: entryContext) { context in @@ -116,6 +117,7 @@ public struct NavigationStack : View where Root: View { exitTransition: { slideOutHorizontally(targetOffsetX: { $0 * (isRTL ? 1 : -1) / 3 }) }, popEnterTransition: { slideInHorizontally(initialOffsetX: { $0 * (isRTL ? 1 : -1) / 3 }) }, popExitTransition: { slideOutHorizontally(targetOffsetX: { $0 * (isRTL ? -1 : 1) }) }) { entry in + navigator.value.syncState() if let state = navigator.value.state(for: entry), let targetValue = state.targetValue { let entryContext = context.content(stateSaver: state.stateSaver) EnvironmentValues.shared.setValues { @@ -360,7 +362,8 @@ final class Navigator { return backStackState[entry.id] } - @Composable private func syncState() { + /// Sync our back stack state with the nav controller. + @Composable func syncState() { let entryList = navController.currentBackStack.collectAsState() // Fill in ID of state we were navigating to if possible diff --git a/Sources/SkipUI/SkipUI/Layout/Presentation.swift b/Sources/SkipUI/SkipUI/Layout/Presentation.swift index ab2e3544..58fb7841 100644 --- a/Sources/SkipUI/SkipUI/Layout/Presentation.swift +++ b/Sources/SkipUI/SkipUI/Layout/Presentation.swift @@ -51,7 +51,6 @@ let overlayPresentationCornerRadius = 16.0 ModalBottomSheet( onDismissRequest: { isPresented.set(false) }, sheetState: sheetState, - containerColor: androidx.compose.ui.graphics.Color.Unspecified, shape: RoundedCornerShape(topStart: overlayPresentationCornerRadius.dp, topEnd: overlayPresentationCornerRadius.dp), dragHandle: nil, windowInsets: WindowInsets(0, 0, 0, 0)